godoor/Dockerfile

22 lines
542 B
Docker
Raw Normal View History

2024-08-15 19:54:09 +00:00
FROM mirror.gcr.io/library/golang:1.21-alpine as build
2023-08-24 19:35:23 +00:00
RUN apk add ca-certificates
2023-08-10 15:42:41 +00:00
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 . .
2023-08-24 19:35:23 +00:00
ENV GOBUILDLDFLAGS="-linkmode 'external' -extldflags '-static'"
RUN go build -tags netgo .
2023-08-10 15:42:41 +00:00
FROM scratch
WORKDIR /
2023-08-24 19:35:23 +00:00
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
2023-08-10 15:42:41 +00:00
COPY --from=build /godoor/godoor /godoor
ENTRYPOINT ["/godoor"]