# ---- Build stage ---- FROM golang:1.25-alpine AS builder WORKDIR /src COPY go.mod go.sum ./ RUN go mod download COPY . . RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /bin/davserver ./cmd/server RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /bin/nidusctl ./tools/nidusctl # ---- Runtime stage ---- FROM alpine:3.19 RUN apk add --no-cache ca-certificates tzdata WORKDIR /app COPY --from=builder /bin/davserver /usr/local/bin/davserver COPY --from=builder /bin/nidusctl /usr/local/bin/nidusctl # Default data and config locations VOLUME ["/app/data"] # config.yaml itself is git-ignored (it holds real secrets), so the image # ships the example config as a working default; mount your own # config.yaml over /app/config.yaml (see docker-compose.yaml) to override it. COPY config.example.yaml /app/config.yaml EXPOSE 8080 ENTRYPOINT ["davserver", "-config", "/app/config.yaml"]