drone-test/Dockerfile
Eg 05f8043672
Some checks failed
continuous-integration/drone/push Build is failing
commit ci file
2022-06-15 11:57:45 +08:00

24 lines
436 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 && upx -9 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"]