From 456de8e11af252a0e49b5844ca13c4c7d726e890 Mon Sep 17 00:00:00 2001 From: alexz Date: Mon, 18 May 2026 01:53:05 -0700 Subject: [PATCH] cfddns: add build/ subdir matching pattern of other custom-image apps - README.md explains the image is built from the separate fork repo at git.alexzaw.dev/alexz/cloudflare-ddns, lists what's in the image, and documents how to rebuild + redeploy. - build.sh clones (or refreshes) /tmp/cfddns-build from the fork via SSH, runs docker build, and pushes to git.alexzaw.dev/alexz/cloudflare-ddns:latest. Supports IMAGE_NAME/IMAGE_TAG/SOURCE_REPO overrides and passes positional args through to docker build (e.g. --no-cache). - .gitignore for build artifacts. --- apps/cfddns/build/.gitignore | 3 ++ apps/cfddns/build/README.md | 66 ++++++++++++++++++++++++++++++++++++ apps/cfddns/build/build.sh | 39 +++++++++++++++++++++ 3 files changed, 108 insertions(+) create mode 100644 apps/cfddns/build/.gitignore create mode 100644 apps/cfddns/build/README.md create mode 100644 apps/cfddns/build/build.sh diff --git a/apps/cfddns/build/.gitignore b/apps/cfddns/build/.gitignore new file mode 100644 index 0000000..77b12c3 --- /dev/null +++ b/apps/cfddns/build/.gitignore @@ -0,0 +1,3 @@ +# Anything Docker / build temp products created in this dir during a build. +*.tar +*.tar.gz diff --git a/apps/cfddns/build/README.md b/apps/cfddns/build/README.md new file mode 100644 index 0000000..c463bf9 --- /dev/null +++ b/apps/cfddns/build/README.md @@ -0,0 +1,66 @@ +# cfddns — Build Files + +The Docker image for this app is **not built from this directory**. The +Dockerfile and Go source live in a separate Gitea-hosted fork at +[`git.alexzaw.dev/alexz/cloudflare-ddns`](https://git.alexzaw.dev/alexz/cloudflare-ddns) +(hard fork of [`favonia/cloudflare-ddns`](https://github.com/favonia/cloudflare-ddns) +with an added `cmd/manager` binary that wraps the original `ddns` updater +with a web UI for managing the domain list). + +The published image is `git.alexzaw.dev/alexz/cloudflare-ddns:latest`. + +## What the image contains + +- `/bin/ddns` — the unmodified upstream Cloudflare DDNS updater. +- `/bin/manager` — the wrapper: web UI (HTTP basic auth) on port 8080, YAML + config at `/config/cfddns.yaml`, supervises `ddns` as a subprocess and + restarts it cleanly on config changes. +- Base: `alpine:3.23` (needed because the Runtipi healthcheck shells out to + `wget --spider` — `scratch` has no userland). +- Multi-arch: currently `linux/amd64` only. Add `linux/arm64` by extending + the buildx build with `--platform`. + +## Building + +```bash +cd /etc/runtipi/repos/runtipi/apps/cfddns/build +./build.sh +``` + +This clones (or updates) the fork into `/tmp/cfddns-build`, runs `docker +build`, and pushes the resulting image to +`git.alexzaw.dev/alexz/cloudflare-ddns:latest`. Docker push credentials must +already be present in `/root/.docker/config.json` (the script runs with +`sudo`). + +To target a different tag or registry: + +```bash +IMAGE_TAG=v1-ui2 ./build.sh +IMAGE_NAME=git.alexzaw.dev/alexz/cfddns IMAGE_TAG=test ./build.sh +``` + +To pass extra flags to `docker build` (e.g. `--no-cache`): + +```bash +./build.sh --no-cache +``` + +## After building + +Follow the standard custom-app deploy chain: + +```bash +cd /etc/runtipi/repos/runtipi +sudo git push origin main # only if app definition changed +cd /etc/runtipi +sudo ./runtipi-cli appstore update +sudo ./runtipi-cli app update cfddns:runtipi +``` + +The new image is pulled automatically by `app update`. + +## Source + +- Fork: +- Upstream: diff --git a/apps/cfddns/build/build.sh b/apps/cfddns/build/build.sh new file mode 100644 index 0000000..c00e3e6 --- /dev/null +++ b/apps/cfddns/build/build.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Build and push the cfddns Docker image. +# The actual Dockerfile + Go source lives in a separate Gitea repo: +# https://git.alexzaw.dev/alexz/cloudflare-ddns +# This script clones (or updates) that repo into /tmp/cfddns-build and runs +# `docker build` + `docker push`. Any positional args are forwarded to +# `docker build` (e.g. `./build.sh --no-cache`). + +set -euo pipefail + +IMAGE_NAME="${IMAGE_NAME:-git.alexzaw.dev/alexz/cloudflare-ddns}" +IMAGE_TAG="${IMAGE_TAG:-latest}" +SOURCE_REPO="${SOURCE_REPO:-ssh://git@git.alexzaw.dev:222/alexz/cloudflare-ddns.git}" +WORKDIR="${WORKDIR:-/tmp/cfddns-build}" + +echo "Building ${IMAGE_NAME}:${IMAGE_TAG} from ${SOURCE_REPO}..." + +if [ -d "${WORKDIR}/.git" ]; then + echo "Refreshing existing clone at ${WORKDIR}..." + git -C "${WORKDIR}" fetch --all --tags + git -C "${WORKDIR}" reset --hard origin/main +else + echo "Cloning ${SOURCE_REPO} -> ${WORKDIR}..." + rm -rf "${WORKDIR}" + git clone "${SOURCE_REPO}" "${WORKDIR}" +fi + +cd "${WORKDIR}" + +sudo docker build "$@" -t "${IMAGE_NAME}:${IMAGE_TAG}" . +sudo docker push "${IMAGE_NAME}:${IMAGE_TAG}" + +echo "" +echo "Built and pushed ${IMAGE_NAME}:${IMAGE_TAG}" +echo "" +echo "Next: deploy via runtipi-cli" +echo " cd /etc/runtipi" +echo " sudo ./runtipi-cli appstore update" +echo " sudo ./runtipi-cli app update cfddns:runtipi"