# Build stage FROM golang:1.23-alpine AS build WORKDIR /app # Cache deps COPY go.mod go.sum ./ RUN go mod download # Copy source and build COPY . . RUN go build -o ddns-updater main.go # Runtime stage FROM alpine:latest WORKDIR /app # Non-root user (optional) RUN adduser -D ddns USER ddns # Copy binary COPY --from=build /app/ddns-updater /usr/local/bin/ddns-updater # Config volume VOLUME ["/config"] ENTRYPOINT ["/usr/local/bin/ddns-updater"] CMD ["-config", "/config/config.yaml"]