-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
32 lines (29 loc) · 1.11 KB
/
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
FROM golang:1.17-alpine AS backend
#ENV GOPROXY="https://proxy.golang.org"
ENV GOPROXY="https://goproxy.cn,https://goproxy.io,direct"
COPY backend /backend
WORKDIR /backend
RUN GO111MODULE="on" GOPROXY=$GOPROXY go mod tidy
RUN GO111MODULE="on" GOPROXY=$GOPROXY CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w"
RUN sed -i "s@https://dl-cdn.alpinelinux.org/@https://mirrors.huaweicloud.com/@g" /etc/apk/repositories
RUN apk update && apk add upx
RUN upx source-analysis-system
FROM node:14-slim AS frontend
ENV NPM_REGISTRY https://mirrors.huaweicloud.com/repository/npm/
ENV NPM_REGISTRY https://registry.npm.taobao.org
COPY frontend /frontend
WORKDIR /frontend
RUN npm config set registry $NPM_REGISTRY && \
npm cache clean -f && \
npm install
RUN npm run-script build
FROM alpine
ENV WAIT_VERSION 2.7.3
ENV WAIT_RELEASE https://github.com/ufoscout/docker-compose-wait/releases/download/$WAIT_VERSION/wait
ADD $WAIT_RELEASE /wait
RUN chmod +x /wait
RUN mkdir -p /app
COPY --from=backend /backend/source-analysis-system /app/
COPY --from=frontend /frontend/dist /app/dist
WORKDIR /app
CMD /wait && ./source-analysis-system