Containerfile
| 1 | FROM docker.io/library/golang:1.26-alpine AS build |
| 2 | WORKDIR /build |
| 3 | COPY go.mod go.sum ./ |
| 4 | RUN go mod download |
| 5 | COPY . . |
| 6 | RUN go vet ./... \ |
| 7 | && CGO_ENABLED=0 go build -trimpath -ldflags='-s -w' -o /physiobase ./cmd/physiobase |
| 8 | |
| 9 | # Laufzeit: Alpine + statisches Binary. Templates/CSS sind eingebettet. |
| 10 | FROM docker.io/library/alpine:3.21 |
| 11 | RUN apk add --no-cache tzdata |
| 12 | COPY --from=build /physiobase /usr/local/bin/physiobase |
| 13 | ENV PHYSIOBASE_DATA_DIR=/data PHYSIOBASE_PORT=8080 TZ=Europe/Berlin |
| 14 | VOLUME ["/data"] |
| 15 | EXPOSE 8080 |
| 16 | HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 CMD ["physiobase", "healthcheck"] |
| 17 | # exec-Form: App ist PID 1 und bekommt SIGTERM direkt (sauberes Herunterfahren, WAL-Checkpoint) |
| 18 | ENTRYPOINT ["/usr/local/bin/physiobase"] |
| 19 |