Files

35 lines
1.5 KiB
Docker

# This image is for local browser E2E only. The release path uses
# Dockerfile and never enables the e2e Go build tag.
ARG GO_IMAGE=golang:1.26.9-alpine
ARG RUNTIME_IMAGE=gcr.io/distroless/static-debian12:nonroot
FROM ${GO_IMAGE} AS build
ENV GOTOOLCHAIN=local
WORKDIR /src/backend
COPY go.mod go.sum ./
RUN go mod download
COPY . ./
RUN CGO_ENABLED=0 GOOS=linux go build -tags=e2e -buildvcs=false -trimpath -ldflags="-s -w" -o /out/app ./cmd/app
RUN CGO_ENABLED=0 GOOS=linux go build -tags=e2e -buildvcs=false -trimpath -ldflags="-s -w" -o /out/consent-fixture ./cmd/consent-fixture
RUN CGO_ENABLED=0 GOOS=linux go build -tags=e2e -buildvcs=false -trimpath -ldflags="-s -w" -o /out/company-fixture ./cmd/company-fixture
RUN CGO_ENABLED=0 GOOS=linux go build -tags=e2e -buildvcs=false -trimpath -ldflags="-s -w" -o /out/questionnaire-fixture ./cmd/questionnaire-fixture
RUN CGO_ENABLED=0 GOOS=linux go build -buildvcs=false -trimpath -ldflags="-s -w" -o /out/assessment-category-attest ./cmd/assessment-category-attest
FROM ${RUNTIME_IMAGE}
LABEL org.opencontainers.image.title="Lincodex local E2E backend" \
org.opencontainers.image.description="Local registration E2E image with a fixed internal mail fixture endpoint"
WORKDIR /
COPY --from=build /out/app /app
COPY --from=build /out/consent-fixture /consent-fixture
COPY --from=build /out/company-fixture /company-fixture
COPY --from=build /out/questionnaire-fixture /questionnaire-fixture
COPY --from=build /out/assessment-category-attest /assessment-category-attest
EXPOSE 8080 9090
USER nonroot:nonroot
ENTRYPOINT ["/app"]