Lauri Võsandi
2008c9f999
All checks were successful
continuous-integration/drone/push Build is passing
24 lines
552 B
Docker
24 lines
552 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'"
|
|
ENV GOOS=linux
|
|
ENV GOARCH=arm64
|
|
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"]
|