Files
ddns-updater/Dockerfile

22 lines
680 B
Docker
Raw Normal View History

FROM golang:1.22 as build
2023-04-28 14:57:21 +02:00
# Copy project sources
COPY . /opt/project/
WORKDIR /opt/project
2024-03-18 10:13:45 +13:00
# Install Pre-Requisites
2023-12-09 16:29:26 +01:00
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates=20230311
2024-03-18 10:13:45 +13:00
# Create a user
RUN useradd --no-create-home --system --shell /bin/false ddnsuser
2023-04-29 15:04:59 +02:00
2023-04-28 14:57:21 +02:00
RUN CGO_ENABLED=0 go build -ldflags="-s -w" -o /cloudflare-ddns-updater
FROM scratch
2023-04-29 15:04:59 +02:00
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
2023-04-28 14:57:21 +02:00
COPY --from=build /cloudflare-ddns-updater /cloudflare-ddns-updater
2024-03-18 10:13:45 +13:00
COPY --from=build /bin/false /bin/false
COPY --from=build /etc/passwd /etc/passwd
USER nobody
2023-04-29 15:04:59 +02:00
ENTRYPOINT ["/cloudflare-ddns-updater"]
CMD ["cloudflare-ddns-updater"]