Files
nginx-stream-server/Dockerfile
jbergner 9cd1862b1b
All checks were successful
release-tag / release-image (push) Successful in 1m58s
go version fix
2025-09-21 15:02:14 +02:00

34 lines
1016 B
Docker
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ---------- Build Stage ----------
FROM golang:1.24-alpine AS build
WORKDIR /src
# SystemDeps nur für Build
RUN apk add --no-cache git ca-certificates tzdata && update-ca-certificates
# Module separat cachen
COPY go.mod go.sum ./
RUN go mod download
# Quellcode
COPY . .
# statisch bauen (kein CGO), mit kleinen Binaries
ENV CGO_ENABLED=0
RUN --mount=type=cache,target=/root/.cache/go-build \
go build -trimpath -ldflags="-s -w" -o /out/dashboard ./cmd/dashboard
# ---------- Runtime Stage ----------
# Distroless ist sehr klein/sicher; enthält CAZertifikate für HTTPSCalls
FROM gcr.io/distroless/base-debian12:nonroot
WORKDIR /app
# Expose Port
EXPOSE 8080
# Copy Binary + benötigte Zeitzonen/Certs sind in Distroless bereits enthalten
COPY --from=build /out/dashboard /app/dashboard
# Security: läuft als nonroot User (Distroless nonroot UID 65532)
USER nonroot:nonroot
# Healthcheck via Startkommando ist nicht möglich in Distroless per Compose lösen
ENTRYPOINT ["/app/dashboard"]