Dockerfile 639 字节
Newer Older
R
rainyan 已提交
1 2
FROM golang:alpine as builder
RUN apk add --update --no-cache yarn make g++
R
rainyan 已提交
3

R
rainyan 已提交
4 5 6 7 8 9 10
ENV GOPROXY=https://goproxy.cn,https://goproxy.io,direct \
    GO111MODULE=on \
    CGO_ENABLED=1
WORKDIR /go/src/gin-vue-admin
RUN go env -w GOPROXY=https://goproxy.cn,https://goproxy.io,direct
COPY . .
RUN go env && go list && go build -v -a -ldflags "-extldflags \"-static\" " -o gvadmin .
R
rainyan 已提交
11

R
rainyan 已提交
12 13 14 15 16
WORKDIR /app
COPY --from=builder /go/src/gin-vue-admin/gvadmin .
COPY --from=builder /go/src/gin-vue-admin/db.db .
COPY --from=builder /go/src/gin-vue-admin/config.yaml .
COPY --from=builder /go/src/gin-vue-admin/resource ./resource
R
rainyan 已提交
17 18 19

EXPOSE 8888

R
rainyan 已提交
20 21
CMD ["gvadmin/app"]