commit ci file
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2022-06-15 11:57:45 +08:00
parent c011fe69c8
commit 05f8043672
4 changed files with 13 additions and 138 deletions

View File

@@ -1,17 +1,24 @@
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
# 指定创建的基础镜像
FROM alpine as runner
# 替换阿里云的源
RUN echo "http://mirrors.aliyun.com/alpine/latest-stable/main/" > /etc/apk/repositories
RUN echo "http://mirrors.aliyun.com/alpine/latest-stable/community/" >> /etc/apk/repositories
WORKDIR /app
COPY --from=builder /builder/app ./app
CMD ./app
CMD ./app
ENTRYPOINT ["./app"]