mirror of
https://github.com/ssep1ol/overleaf-registration-be.git
synced 2026-07-21 20:40:21 +00:00
31 lines
791 B
Docker
31 lines
791 B
Docker
# syntax=docker/dockerfile:1
|
|
|
|
FROM --platform=$BUILDPLATFORM golang:1.23-alpine AS build
|
|
|
|
WORKDIR /src
|
|
ENV GOTOOLCHAIN=local
|
|
|
|
RUN apk add --no-cache ca-certificates
|
|
|
|
COPY go.mod go.sum ./
|
|
RUN --mount=type=cache,target=/go/pkg/mod go mod download
|
|
|
|
COPY . .
|
|
|
|
ARG TARGETOS=linux
|
|
ARG TARGETARCH
|
|
RUN --mount=type=cache,target=/go/pkg/mod \
|
|
--mount=type=cache,target=/root/.cache/go-build \
|
|
CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=${TARGETARCH:-$(go env GOARCH)} \
|
|
go build -trimpath -tags netgo -ldflags="-s -w" -o /out/overleaf-registration-be .
|
|
|
|
FROM scratch AS runtime
|
|
|
|
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
|
COPY --from=build /out/overleaf-registration-be /overleaf-registration-be
|
|
|
|
USER 65532:65532
|
|
EXPOSE 3000
|
|
|
|
ENTRYPOINT ["/overleaf-registration-be"]
|