27 lines
1005 B
Docker
27 lines
1005 B
Docker
# ---- build ----
|
|
FROM golang:1.24 AS build
|
|
WORKDIR /src
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
COPY . .
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /out/vindn-backend ./cmd/server
|
|
|
|
# ---- runtime ----
|
|
# "static" (not "-nonroot") to match the existing root:root ownership of the
|
|
# bind-mounted ./backend/public/storage host directory shared with the
|
|
# frontend container — switching to a non-root UID here would need that
|
|
# directory rechowned too, or every media download starts failing silently.
|
|
FROM gcr.io/distroless/static-debian12
|
|
|
|
# The imported event data and the site's audience are both German-local;
|
|
# default to that instead of UTC so the twice-daily cron (see tasks/Cronjob.go)
|
|
# actually fires at 06:00/18:00 German time, not UTC. distroless/static ships
|
|
# tzdata, but time/tzdata is also embedded in the binary above for safety.
|
|
ENV TZ=Europe/Berlin
|
|
|
|
WORKDIR /app
|
|
COPY --from=build /out/vindn-backend ./vindn-backend
|
|
|
|
EXPOSE 8080
|
|
ENTRYPOINT ["./vindn-backend"]
|