From 7e6f890c95817e3951ad7f33058a68aa2c39d14e Mon Sep 17 00:00:00 2001 From: Cromefire_ Date: Sat, 27 Jul 2024 00:27:01 +0200 Subject: [PATCH] Fixed distroless docker container and some warnings and improved readme --- Dockerfile | 12 ++++++------ README.md | 24 +++++++++++++++++++++--- alpine.Dockerfile | 12 ++++++------ 3 files changed, 33 insertions(+), 15 deletions(-) diff --git a/Dockerfile b/Dockerfile index 633ce21..44a33c4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21-alpine as server_build +FROM golang:1.22-alpine AS server_build WORKDIR /appbuild @@ -13,11 +13,11 @@ RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/r # Build deployable server FROM gcr.io/distroless/static:debug -ENV FRITZBOX_ENDPOINT_URL=${FRITZBOX_ENDPOINT_URL:-http://fritz.box:49000} \ - FRITZBOX_ENDPOINT_TIMEOUT=${FRITZBOX_ENDPOINT_TIMEOUT:-30s} \ - DYNDNS_SERVER_BIND=${DYNDNS_SERVER_BIND:-:8080} \ - DYNDNS_SERVER_USERNAME=${DYNDNS_SERVER_USERNAME} \ - DYNDNS_SERVER_PASSWORD=${DYNDNS_SERVER_PASSWORD} \ +ENV FRITZBOX_ENDPOINT_URL="http://fritz.box:49000" \ + FRITZBOX_ENDPOINT_TIMEOUT="30s" \ + DYNDNS_SERVER_BIND=":8080" \ + DYNDNS_SERVER_USERNAME="" \ + DYNDNS_SERVER_PASSWORD="" \ CLOUDFLARE_API_EMAIL="" \ CLOUDFLARE_API_KEY="" \ CLOUDFLARE_ZONES_IPV4="" \ diff --git a/README.md b/README.md index 3268954..22cfbff 100644 --- a/README.md +++ b/README.md @@ -155,10 +155,28 @@ process. ## Docker build -_Note: A pre-built docker image is also available on this -GitHub [repository](https://github.com/cromefire/fritzbox-cloudflare-dyndns/pkgs/container/fritzbox-cloudflare-dyndns)._ +A pre-built docker image is also available on this +GitHub [repository](https://github.com/cromefire/fritzbox-cloudflare-dyndns/pkgs/container/fritzbox-cloudflare-dyndns) +as `ghcr.io/cromefire/fritzbox-cloudflare-dyndns:`. +The version is something like `1.2` (you can leave out the patch version), please don't use `latest` directly, as it may +break at any point with a major release. -More raw approach would be to build and run it yourself: +You can use it with compose like this: + +```yaml +name: "dyndns" +services: + updater: + image: "ghcr.io/cromefire/fritzbox-cloudflare-dyndns:" + env_file: ./updater.env + restart: unless-stopped + ports: + - 8080/tcp +``` + +With your secret configure in the `updater.env` file next to it (as `SOME_VARIABLE=`). + +The more raw approach would be to build and run it yourself: ``` docker build -t fritzbox-cloudflare-dyndns . diff --git a/alpine.Dockerfile b/alpine.Dockerfile index 0730272..f3e0114 100644 --- a/alpine.Dockerfile +++ b/alpine.Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.22-alpine as server_build +FROM golang:1.22-alpine AS server_build WORKDIR /appbuild @@ -13,11 +13,11 @@ RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/r # Build deployable server FROM alpine:3 -ENV FRITZBOX_ENDPOINT_URL=${FRITZBOX_ENDPOINT_URL:-http://fritz.box:49000} \ - FRITZBOX_ENDPOINT_TIMEOUT=${FRITZBOX_ENDPOINT_TIMEOUT:-30s} \ - DYNDNS_SERVER_BIND=${DYNDNS_SERVER_BIND:-:8080} \ - DYNDNS_SERVER_USERNAME=${DYNDNS_SERVER_USERNAME} \ - DYNDNS_SERVER_PASSWORD=${DYNDNS_SERVER_PASSWORD} \ +ENV FRITZBOX_ENDPOINT_URL="http://fritz.box:49000" \ + FRITZBOX_ENDPOINT_TIMEOUT="30s" \ + DYNDNS_SERVER_BIND=":8080" \ + DYNDNS_SERVER_USERNAME="" \ + DYNDNS_SERVER_PASSWORD="" \ CLOUDFLARE_API_EMAIL="" \ CLOUDFLARE_API_KEY="" \ CLOUDFLARE_ZONES_IPV4="" \