forked from clickvisual/clickvisual
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
50 lines (38 loc) · 1.37 KB
/
Copy pathDockerfile
File metadata and controls
50 lines (38 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# UI build stage
FROM node:20-alpine AS js-builder
ENV NODE_OPTIONS=--max_old_space_size=8000
WORKDIR /clickvisual
COPY ui/package.json ui/yarn.lock ./ui/
COPY ui/patches ./ui/patches
COPY ui-v2/package.json ui-v2/package-lock.json ./ui-v2/
RUN cd ui && yarn install --frozen-lockfile --network-timeout 100000
RUN cd ui-v2 && npm install
ENV NODE_ENV=production
COPY ui ./ui
COPY ui-v2 ./ui-v2
RUN cd ui && yarn build
RUN cd ui-v2 && npm run build
# API build stage
FROM golang:1.21.0-alpine3.17 AS go-builder
ARG GOPROXY=goproxy.cn
ENV GOPROXY=https://${GOPROXY},direct
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
RUN apk add --no-cache make bash git tzdata
WORKDIR /clickvisual
COPY go.mod go.sum ./
RUN go mod download -x
COPY . .
COPY --from=js-builder /clickvisual/ui/dist ./api/internal/ui/dist
COPY --from=js-builder /clickvisual/ui-v2/api/internal/ui/v2dist/dist ./api/internal/ui/v2dist/dist
RUN ls -rlt ./api/internal/ui/dist && make build.api
# Fianl running stage
FROM alpine:3.17
LABEL maintainer="clickvisual@shimo.im"
WORKDIR /clickvisual
COPY --from=go-builder /clickvisual/bin/clickvisual ./bin/
COPY --from=go-builder /clickvisual/config ./config
EXPOSE 9001
EXPOSE 9003
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
RUN apk --update add --no-cache tzdata
CMD ["sh", "-c", "./bin/clickvisual server"]