Files
cloudflare-ddns/Dockerfile
renovate[bot] 086ed6135a build(deps): update all non-major dependencies (#920)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: favonia <favonia@gmail.com>
2024-09-10 10:39:52 +00:00

25 lines
829 B
Docker

# We use cross-compilation because QEMU is slow.
FROM --platform=${BUILDPLATFORM} golang:1.23.1-alpine3.20@sha256:ac67716dd016429be8d4c2c53a248d7bcdf06d34127d3dc451bda6aa5a87bc06 AS build
ARG GIT_DESCRIBE
ARG TARGETOS
ARG TARGETARCH
ARG TARGETVARIANT
# See .dockerignore for the list of files being copied.
WORKDIR "/src/"
COPY [".", "/src/"]
# Compile the code.
RUN \
CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} GOARM=${TARGETVARIANT#v} \
go build -tags "timetzdata" -trimpath -ldflags="-w -s -X main.Version=${GIT_DESCRIBE} -buildid=" \
-o /bin/ddns ./cmd/ddns
# The minimal images contain only the program and the consolidated certificates.
FROM scratch AS minimal
COPY --from=build /bin/ddns /bin/
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
USER 1000:1000
ENTRYPOINT ["/bin/ddns"]