forked from clickvisual/clickvisual
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
42 lines (30 loc) · 859 Bytes
/
Dockerfile
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
# UI build stage
FROM node:16-alpine3.14 as js-builder
ENV NODE_OPTIONS=--max_old_space_size=8000
WORKDIR /mogo
COPY ui/package.json ui/yarn.lock ./
RUN yarn install
ENV NODE_ENV production
COPY ui .
RUN yarn build
# API build stage
FROM golang:1.17.3-alpine3.14 as go-builder
ENV GOPROXY=https://goproxy.cn,direct
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
RUN apk add --no-cache make bash git
WORKDIR /mogo
COPY go.mod go.sum ./
RUN go mod download -x
COPY scripts scripts
COPY api api
COPY Makefile Makefile
COPY --from=js-builder /mogo/dist ./api/internal/ui/dist
RUN ls -rlt ./api/internal/ui/dist && make build.api
# Fianl running stage
FROM alpine:3.14.3
LABEL maintainer="[email protected]"
WORKDIR /mogo
COPY --from=go-builder /mogo/bin/mogo ./bin/
EXPOSE 9001
EXPOSE 9003
CMD ["sh", "-c", "./bin/mogo"]