ADD: added dockerfiles and a logger for the backend

This commit is contained in:
hwinkel
2025-12-15 13:30:41 +01:00
parent 7ec17e1e8b
commit 435ad8e6e6
12 changed files with 183 additions and 19 deletions

29
Dockerfile.backend Normal file
View File

@@ -0,0 +1,29 @@
# =========================
# Build stage
# =========================
FROM golang:1.25.5-alpine AS builder
WORKDIR /app
COPY backend/go.mod backend/go.sum ./
RUN go mod download
COPY backend/ ./
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
go build -o server ./cmd/server
# =========================
# Runtime stage
# =========================
FROM gcr.io/distroless/base-debian12
WORKDIR /app
COPY --from=builder /app/server ./server
EXPOSE 8081
USER nonroot:nonroot
ENTRYPOINT ["./server"]