Files
hetzner-api-dyndns-records-…/Dockerfile
T
admin f02ec9977c
Container-Image veröffentlichen / container (push) Has been cancelled
feat: add resilient updates and access controls
2026-08-28 14:02:07 +02:00

33 lines
1.0 KiB
Docker

# syntax=docker/dockerfile:1.7
FROM golang:1.25.13-alpine AS build
ARG VERSION=v1.3.0
RUN apk add --no-cache build-base
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=1 GOOS=linux go build -trimpath -ldflags="-s -w -X github.com/root-kdw12/hetzner-api-dyndns-records-webinterface/internal/buildinfo.Version=${VERSION}" -o /out/dyndns-web ./cmd/dyndns-web && \
CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /out/update-agent ./cmd/update-agent
FROM alpine:3.23.2 AS runtime
RUN apk add --no-cache ca-certificates && \
addgroup -S -g 10001 dyndns && \
adduser -S -D -H -u 10001 -G dyndns dyndns && \
mkdir -p /data /secrets && chown dyndns:dyndns /data /secrets
COPY --from=build /out/dyndns-web /usr/local/bin/dyndns-web
COPY --from=build /out/update-agent /usr/local/bin/update-agent
USER dyndns:dyndns
WORKDIR /data
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 CMD ["/usr/local/bin/dyndns-web", "healthcheck"]
ENTRYPOINT ["/usr/local/bin/dyndns-web"]