FROM golang:alpine ENV GO111MODULE=on ENV GOPROXY=https://goproxy.io,direct WORKDIR /go/src/gin-vue-admin COPY server/ ./ RUN cat ./config.yaml COPY .docker-compose/shell/server-handle.sh . RUN ls -al RUN sh ./server-handle.sh RUN rm -f server-handle.sh RUN cat ./config.yaml RUN go env && go build -o server . FROM alpine:latest LABEL MAINTAINER="SliverHorn@sliver_horn@qq.com" WORKDIR /go/src/gin-vue-admin COPY --from=0 /go/src/gin-vue-admin/server ./ COPY --from=0 /go/src/gin-vue-admin/config.yaml ./ COPY --from=0 /go/src/gin-vue-admin/resource ./resource ENTRYPOINT ./server # 根据Dockerfile生成Docker镜像 # docker build -t gva-server:1.0 . #- 根据Docker镜像启动Docker容器 # - 后台运行 # - ``` # docker run -d -p 8888:8888 --name gva-server-v1 gva-server:1.0 # ``` # - 以可交互模式运行, Ctrl + p + q # - ``` # docker run -it -p 8888:8888 --name gva-server-v1 gva-server:1.0 # ```