Containerfile
⎇
Raw
1FROM docker.io/library/golang:1.26-alpine AS build
2WORKDIR /build
3COPY go.mod go.sum ./
4RUN go mod download
5COPY . .
6RUN 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.
10FROM docker.io/library/alpine:3.21
11RUN apk add --no-cache tzdata
12COPY --from=build /physiobase /usr/local/bin/physiobase
13ENV PHYSIOBASE_DATA_DIR=/data PHYSIOBASE_PORT=8080 TZ=Europe/Berlin
14VOLUME ["/data"]
15EXPOSE 8080
16HEALTHCHECK --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)
18ENTRYPOINT ["/usr/local/bin/physiobase"]
19