godoor/Dockerfile
Lauri Võsandi 5e64dfa04a
All checks were successful
continuous-integration/drone/push Build is passing
Native builds in Docker file and multiarch build by Drone
2023-09-13 11:43:20 +03:00

22 lines
520 B
Docker

FROM golang:1.21-alpine as build
RUN apk add ca-certificates
WORKDIR /godoor
# pre-copy/cache go.mod for pre-downloading dependencies and only redownloading them in subsequent builds if they change
COPY go.mod go.sum ./
RUN go mod download && go mod verify
COPY . .
ENV GOBUILDLDFLAGS="-linkmode 'external' -extldflags '-static'"
RUN go build -tags netgo .
FROM scratch
WORKDIR /
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=build /godoor/godoor /godoor
ENTRYPOINT ["/godoor"]