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.
This commit is contained in:
39
apps/cfddns/build/build.sh
Normal file
39
apps/cfddns/build/build.sh
Normal file
@@ -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"
|
||||
Reference in New Issue
Block a user