Browse Source
Merge pull request #883 from tscuite/main
dockerfile优化:减小镜像大小 ,更改node版本为16,同时npm更换为yarn
main
奇淼(piexlmax
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
12 additions and
11 deletions
-
server/Dockerfile
-
web/Dockerfile
|
@ -3,20 +3,22 @@ FROM golang:alpine as builder |
|
|
WORKDIR /go/src/github.com/flipped-aurora/gin-vue-admin/server |
|
|
WORKDIR /go/src/github.com/flipped-aurora/gin-vue-admin/server |
|
|
COPY . . |
|
|
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 |
|
|
FROM alpine:latest |
|
|
|
|
|
|
|
|
LABEL MAINTAINER="SliverHorn@sliver_horn@qq.com" |
|
|
LABEL MAINTAINER="SliverHorn@sliver_horn@qq.com" |
|
|
|
|
|
|
|
|
WORKDIR /go/src/github.com/flipped-aurora/gin-vue-admin/server |
|
|
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 |
|
|
EXPOSE 8888 |
|
|
|
|
|
|
|
|
ENTRYPOINT ./server -c config.docker.yaml |
|
|
ENTRYPOINT ./server -c config.docker.yaml |
|
@ -1,10 +1,9 @@ |
|
|
FROM node:12.16.1 |
|
|
|
|
|
|
|
|
FROM node:16 |
|
|
|
|
|
|
|
|
WORKDIR /gva_web/ |
|
|
WORKDIR /gva_web/ |
|
|
COPY . . |
|
|
COPY . . |
|
|
|
|
|
|
|
|
RUN npm install |
|
|
|
|
|
RUN npm run build |
|
|
|
|
|
|
|
|
RUN yarn && yarn build |
|
|
|
|
|
|
|
|
FROM nginx:alpine |
|
|
FROM nginx:alpine |
|
|
LABEL MAINTAINER="SliverHorn@sliver_horn@qq.com" |
|
|
LABEL MAINTAINER="SliverHorn@sliver_horn@qq.com" |
|
|