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] =?UTF-8?q?dockerfile=E4=BC=98=E5=8C=96=EF=BC=9A=E5=87=8F?= =?UTF-8?q?=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