drone-test/Dockerfile
loser bdeee90549
Some checks failed
continuous-integration/drone/push Build is failing
更新 'Dockerfile'
2022-06-15 12:49:06 +08:00

24 lines
422 B
Docker
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

FROM golang:1.18 as builder
# 启用go module
ENV GO111MODULE=on \
GOPROXY=https://goproxy.cn,direct
WORKDIR /builder
COPY . .
RUN go mod download && go build -o app
RUN ls -lh && chmod +x ./app
COPY . .
# 指定OS等并go build
RUN GOOS=linux GOARCH=amd64 go build .
# 运行阶段指定scratch作为基础镜像
FROM alpine
WORKDIR /app
COPY --from=builder /builder/app ./app
CMD ./app
ENTRYPOINT ["./app"]