Dockerfile 564 字节
FROM golang:1.14 as builder
ENV APP_DIR $GOPATH/src/godevp
RUN mkdir -p $APP_DIR
WORKDIR $APP_DIR/
COPY ./pkg pkg
COPY ./conf conf
COPY ./go.mod go.mod
COPY ./main.go main.go
# RUN ["ln","-sf","/usr/share/zoneinfo/Asia/Shanghai","/etc/localtime"]
ENV GO111MODULE on
ENV GOPROXY https://goproxy.cn,direct
RUN go mod tidy
RUN GOOS=linux CGO_ENABLED=0 go build -ldflags="-s -w" -o godevp .

FROM alpine:latest
RUN ["ln","-sf","/usr/share/zoneinfo/Asia/Shanghai","/etc/localtime"]
WORKDIR /root/
COPY --from=builder /go/src/godevp .
EXPOSE 8082
ENTRYPOINT ["./godevp"]