Skip to content

Commit ab486bb

Browse files
author
奇淼(piexlmax
authored
Merge pull request #883 from tscuite/main
dockerfile优化:减小镜像大小 ,更改node版本为16,同时npm更换为yarn
2 parents f99c782 + f53b127 commit ab486bb

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

server/Dockerfile

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,22 @@ FROM golang:alpine as builder
33
WORKDIR /go/src/github.com/flipped-aurora/gin-vue-admin/server
44
COPY . .
55

6-
RUN go env -w GO111MODULE=on
7-
RUN go env -w GOPROXY=https://goproxy.cn,direct
8-
RUN go env -w CGO_ENABLED=0
9-
RUN go env
10-
RUN go mod tidy
11-
RUN go build -o server .
6+
RUN go env -w GO111MODULE=on \
7+
&& go env -w GOPROXY=https://goproxy.cn,direct \
8+
&& go env -w CGO_ENABLED=0 \
9+
&& go env \
10+
&& go mod tidy \
11+
&& go build -o server .
1212

1313
FROM alpine:latest
14+
1415
LABEL MAINTAINER="SliverHorn@[email protected]"
1516

1617
WORKDIR /go/src/github.com/flipped-aurora/gin-vue-admin/server
1718

18-
COPY --from=0 /go/src/github.com/flipped-aurora/gin-vue-admin/server ./
19+
COPY --from=0 /go/src/github.com/flipped-aurora/gin-vue-admin/server/server ./
20+
COPY --from=0 /go/src/github.com/flipped-aurora/gin-vue-admin/server/resource ./resource/
21+
COPY --from=0 /go/src/github.com/flipped-aurora/gin-vue-admin/server/config.docker.yaml ./
1922

2023
EXPOSE 8888
21-
2224
ENTRYPOINT ./server -c config.docker.yaml

web/Dockerfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
FROM node:12.16.1
1+
FROM node:16
22

33
WORKDIR /gva_web/
44
COPY . .
55

6-
RUN npm install
7-
RUN npm run build
6+
RUN yarn && yarn build
87

98
FROM nginx:alpine
109
LABEL MAINTAINER="SliverHorn@[email protected]"

0 commit comments

Comments
 (0)