drone-test/Dockerfile

22 lines
331 B
Docker
Raw Normal View History

2022-06-15 10:58:05 +08:00
FROM golang:1.18 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 .
2022-06-15 12:55:19 +08:00
2022-06-15 11:57:45 +08:00
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"]