-
Notifications
You must be signed in to change notification settings - Fork 227
/
Copy pathDockerfile.subpath
47 lines (33 loc) · 1.12 KB
/
Dockerfile.subpath
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
# UI build stage
FROM node:16-alpine3.17 as js-builder
ENV NODE_OPTIONS=--max_old_space_size=8000
WORKDIR /clickvisual
COPY ui/package.json ui/yarn.lock ./
ENV PUBLIC_PATH=/clickvisual/
RUN yarn install --frozen-lockfile --network-timeout 100000
ENV NODE_ENV production
COPY ui .
RUN yarn 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/dist ./api/internal/ui/dist
RUN ls -rlt ./api/internal/ui/dist && make build.api
# Fianl running stage
FROM alpine:3.17
LABEL maintainer="[email protected]"
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"]