From ee3ae0da73c0894770435c352113747ef325d9f0 Mon Sep 17 00:00:00 2001 From: tscuite <64051240+tscuite@users.noreply.github.com> Date: Wed, 12 Jan 2022 10:22:14 +0800 Subject: [PATCH 1/2] =?UTF-8?q?dockerfile=E4=BC=98=E5=8C=96=EF=BC=9A?= =?UTF-8?q?=E5=87=8F=E5=B0=8F=E9=95=9C=E5=83=8F=E5=A4=A7=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit dockerfile优化:减小镜像大小,RUN合并为一条命令 --- server/Dockerfile | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/server/Dockerfile b/server/Dockerfile index 5c3b8861..545f7083 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -3,20 +3,22 @@ FROM golang:alpine as builder WORKDIR /go/src/github.com/flipped-aurora/gin-vue-admin/server COPY . . -RUN go env -w GO111MODULE=on -RUN go env -w GOPROXY=https://goproxy.cn,direct -RUN go env -w CGO_ENABLED=0 -RUN go env -RUN go mod tidy -RUN go build -o server . +RUN go env -w GO111MODULE=on \ + && go env -w GOPROXY=https://goproxy.cn,direct \ + && go env -w CGO_ENABLED=0 \ + && go env \ + && go mod tidy \ + && go build -o server . FROM alpine:latest + LABEL MAINTAINER="SliverHorn@sliver_horn@qq.com" WORKDIR /go/src/github.com/flipped-aurora/gin-vue-admin/server -COPY --from=0 /go/src/github.com/flipped-aurora/gin-vue-admin/server ./ +COPY --from=0 /go/src/github.com/flipped-aurora/gin-vue-admin/server/server ./ +COPY --from=0 /go/src/github.com/flipped-aurora/gin-vue-admin/server/resource ./resource/ +COPY --from=0 /go/src/github.com/flipped-aurora/gin-vue-admin/server/config.docker.yaml ./ EXPOSE 8888 - ENTRYPOINT ./server -c config.docker.yaml From f53b12708f5f34fe81689fa872c8e533b005276c Mon Sep 17 00:00:00 2001 From: tscuite <64051240+tscuite@users.noreply.github.com> Date: Wed, 12 Jan 2022 10:48:25 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BC=98=E5=8C=96dockerfile=EF=BC=9A?= =?UTF-8?q?=E6=9B=B4=E6=94=B9node=E7=89=88=E6=9C=AC=E4=B8=BA16=EF=BC=8C?= =?UTF-8?q?=E5=90=8C=E6=97=B6npm=E6=9B=B4=E6=8D=A2=E4=B8=BAyarn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 优化dockerfile:更改node版本为16,同时npm更换为yarn --- web/Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/web/Dockerfile b/web/Dockerfile index b40db4ac..31f329ce 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -1,10 +1,9 @@ -FROM node:12.16.1 +FROM node:16 WORKDIR /gva_web/ COPY . . -RUN npm install -RUN npm run build +RUN yarn && yarn build FROM nginx:alpine LABEL MAINTAINER="SliverHorn@sliver_horn@qq.com"