作者 yangfu

Dockerfile fix

正在显示 1 个修改的文件 包含 7 行增加2 行删除
1 -FROM golang:1.14 1 +FROM golang:1.14 as builder
2 ENV APP_DIR $GOPATH/src/godevp 2 ENV APP_DIR $GOPATH/src/godevp
3 RUN mkdir -p $APP_DIR 3 RUN mkdir -p $APP_DIR
4 WORKDIR $APP_DIR/ 4 WORKDIR $APP_DIR/
@@ -6,10 +6,15 @@ COPY ./pkg pkg @@ -6,10 +6,15 @@ COPY ./pkg pkg
6 COPY ./conf conf 6 COPY ./conf conf
7 COPY ./go.mod go.mod 7 COPY ./go.mod go.mod
8 COPY ./main.go main.go 8 COPY ./main.go main.go
9 -RUN ["ln","-sf","/usr/share/zoneinfo/Asia/Shanghai","/etc/localtime"] 9 +# RUN ["ln","-sf","/usr/share/zoneinfo/Asia/Shanghai","/etc/localtime"]
10 ENV GO111MODULE on 10 ENV GO111MODULE on
11 ENV GOPROXY https://goproxy.cn,direct 11 ENV GOPROXY https://goproxy.cn,direct
12 RUN ["go","mod","tidy"] 12 RUN ["go","mod","tidy"]
13 RUN ["go","build"] 13 RUN ["go","build"]
  14 +
  15 +FROM alpine:latest
  16 +RUN ["ln","-sf","/usr/share/zoneinfo/Asia/Shanghai","/etc/localtime"]
  17 +WORKDIR /root/
  18 +COPY --from=builder /go/src/godevp .
14 EXPOSE 8082 19 EXPOSE 8082
15 ENTRYPOINT ["./godevp"] 20 ENTRYPOINT ["./godevp"]