drone-test/Dockerfile

21 lines
332 B
Docker
Raw Normal View History

2022-06-17 17:34:11 +08:00
FROM golang:alpine as builder
2022-06-15 11:43:40 +08:00
2022-06-15 11:57:45 +08:00
ENV GO111MODULE=on \
GOPROXY=https://goproxy.cn,direct
2022-06-15 11:43:40 +08:00
WORKDIR /builder
2022-06-15 10:58:05 +08:00
COPY . .
2022-06-15 12:55:19 +08:00
RUN go mod download && go build -o app
2022-06-15 11:43:40 +08:00
RUN ls -lh && chmod +x ./app
2022-06-15 11:57:45 +08:00
COPY . .
RUN GOOS=linux GOARCH=amd64 go build .
FROM alpine
2022-06-15 11:43:40 +08:00
2022-06-15 10:58:05 +08:00
WORKDIR /app
2022-06-15 11:43:40 +08:00
COPY --from=builder /builder/app ./app
2022-06-15 11:57:45 +08:00
CMD ./app
ENTRYPOINT ["./app"]