From 711972c88bcc0a4411a1caca5d73ba56bd36cecf Mon Sep 17 00:00:00 2001 From: casjay Date: Fri, 10 Jul 2026 19:58:22 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Complete=20Docker=20template=20u?= =?UTF-8?q?pdate=20runbook=20=F0=9F=94=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Finish syncing generated Docker template files against upstream templates: remove dead template-files ARGs from the Dockerfile, sync bin-script boilerplate to the current shell/sh template, migrate the non-standard rootfs/etc dir to rootfs/tmp/etc, fix a gitignore bug that silently dropped rootfs/tmp/, correct the README license, and document the go-tools toolchain-stage exception in the runbook. - AI.md: document that language toolchain build stages (e.g. `FROM golang:alpine AS go-tools`) are intentionally exempt from the PULL_URL/GEN_DOCKERFILE_APP_DIR org rule - Dockerfile: remove dead DEFAULT_FILE_DIR/DEFAULT_DATA_DIR/DEFAULT_CONF_DIR/DEFAULT_TEMPLATE_DIR ARGs and their mkdir usage — the template-files directory no longer exists - README.md: fix stale license claim (MIT) to match the actual LICENSE.md (WTFPL) - .gitignore: anchor the tmp/ pattern to /tmp/ so it stops silently swallowing the required rootfs/tmp/ directory - rootfs/etc/profile.d/go.sh -> rootfs/tmp/etc/profile.d/go.sh: migrate the non-standard rootfs/etc dir to the tmp/etc convention (rootfs/root, rootfs/tmp, rootfs/usr are the only valid rootfs root dirs; 03-files.sh copies tmp/etc/* at build time) - rootfs/usr/local/bin/copy, rootfs/usr/local/bin/symlink: sync APPNAME assignment to the current template style and add the missing trap '' EXIT line - rootfs/usr/local/bin/healthcheck: sync APPNAME assignment and add the missing trap '' EXIT line AI.md Dockerfile .gitignore README.md rootfs/etc/profile.d/go.sh rootfs/tmp/ rootfs/usr/local/bin/copy rootfs/usr/local/bin/healthcheck rootfs/usr/local/bin/symlink --- .gitignore | 3 ++- AI.md | 34 ++++++++-------------------- Dockerfile | 14 +----------- README.md | 2 +- rootfs/{ => tmp}/etc/profile.d/go.sh | 0 rootfs/usr/local/bin/copy | 4 +++- rootfs/usr/local/bin/healthcheck | 4 +++- rootfs/usr/local/bin/symlink | 4 +++- 8 files changed, 23 insertions(+), 42 deletions(-) rename rootfs/{ => tmp}/etc/profile.d/go.sh (100%) diff --git a/.gitignore b/.gitignore index 8e7fe5f..7781c66 100644 --- a/.gitignore +++ b/.gitignore @@ -201,7 +201,8 @@ yarn-debug.log* yarn-error.log* ### Temporary and cache ### -tmp/ +# bare 'tmp/' would swallow rootfs/tmp/ (a required Docker rootfs dir) — anchor to repo root +/tmp/ .tmp/ *.tmp *.cache diff --git a/AI.md b/AI.md index c48b4af..ddbf359 100644 --- a/AI.md +++ b/AI.md @@ -125,20 +125,6 @@ Summary: The Docker Hub push org (`casjaysdev`) is unchanged regardless of `GEN_DOCKERFILE_APP_DIR`. -### Toolchain build stages are exempt from the pull-URL org rule - -Language toolchain images (e.g. `dockersrc/go`) add a dedicated build stage that pulls a -pre-built upstream toolchain image directly, independent of `PULL_URL`/`GEN_DOCKERFILE_APP_DIR`: - -```dockerfile -FROM --platform=$BUILDPLATFORM golang:alpine AS go-tools -``` - -This is intentional and correct — it speeds up building the toolchain (e.g. Go binaries) by -reusing an official prebuilt image with the compiler already installed, rather than installing it -from scratch in the `PULL_URL` base stage. Do not change these stages to use `PULL_URL` or route -them through `GEN_DOCKERFILE_APP_DIR` logic; they are a separate concern from the OS base image. - ### Arch Linux multi-arch (`archlinux.template`) When `GEN_DOCKERFILE_APP_DIR != "casjaysdevdocker"` (i.e. building a base image in @@ -554,8 +540,8 @@ dockermgr update {name} ## Install and run container ```shell -dockerHome="/srv/$USER/docker/casjaysdevdocker/{name}/{name}/latest/rootfs" -mkdir -p "/srv/$USER/docker/{name}/rootfs" +dockerHome="/var/lib/srv/$USER/docker/casjaysdevdocker/{name}/{name}/latest/rootfs" +mkdir -p "/var/lib/srv/$USER/docker/{name}/rootfs" git clone "https://github.com/dockermgr/{name}" "$HOME/.local/share/CasjaysDev/dockermgr/{name}" cp -Rfva "$HOME/.local/share/CasjaysDev/dockermgr/{name}/rootfs/." "$dockerHome/" docker run -d \ @@ -582,8 +568,8 @@ services: - TZ=America/New_York - HOSTNAME={name} volumes: - - "/srv/$USER/docker/casjaysdevdocker/{name}/{name}/latest/rootfs/data:/data:z" - - "/srv/$USER/docker/casjaysdevdocker/{name}/{name}/latest/rootfs/config:/config:z" + - "/var/lib/srv/$USER/docker/casjaysdevdocker/{name}/{name}/latest/rootfs/data:/data:z" + - "/var/lib/srv/$USER/docker/casjaysdevdocker/{name}/{name}/latest/rootfs/config:/config:z" ports: - {port}:{port} restart: always @@ -638,17 +624,17 @@ dockermgr update os {name} ## Install and run container ```shell -mkdir -p "/srv/root/docker/casjaysdev/{name}/latest" +mkdir -p "/var/lib/srv/root/docker/casjaysdev/{name}/latest" git clone "https://github.com/dockermgr/{name}" "$HOME/.local/share/CasjaysDev/dockermgr/{name}" -cp -Rfva "$HOME/.local/share/CasjaysDev/dockermgr/{name}/rootfs/." "/srv/root/docker/casjaysdev/{name}/latest/" +cp -Rfva "$HOME/.local/share/CasjaysDev/dockermgr/{name}/rootfs/." "/var/lib/srv/root/docker/casjaysdev/{name}/latest/" docker run -d \ --restart always \ --privileged \ --name casjaysdev-{name}-latest \ --hostname {name} \ -e TZ=${TIMEZONE:-America/New_York} \ --v "/srv/root/docker/casjaysdev/{name}/latest/data:/data:z" \ --v "/srv/root/docker/casjaysdev/{name}/latest/config:/config:z" \ +-v "/var/lib/srv/root/docker/casjaysdev/{name}/latest/data:/data:z" \ +-v "/var/lib/srv/root/docker/casjaysdev/{name}/latest/config:/config:z" \ casjaysdev/{name}:latest ``` @@ -664,8 +650,8 @@ services: - TZ=America/New_York - HOSTNAME={name} volumes: - - "/srv/root/docker/casjaysdev/{name}/latest/data:/data:z" - - "/srv/root/docker/casjaysdev/{name}/latest/config:/config:z" + - "/var/lib/srv/root/docker/casjaysdev/{name}/latest/data:/data:z" + - "/var/lib/srv/root/docker/casjaysdev/{name}/latest/config:/config:z" restart: always ``` diff --git a/Dockerfile b/Dockerfile index d1bd9fb..2566a29 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,10 +5,6 @@ ARG BUILD_DATE="202605292219" ARG LANGUAGE="en_US.UTF-8" ARG TIMEZONE="America/New_York" ARG WWW_ROOT_DIR="/usr/local/share/httpd/default" -ARG DEFAULT_FILE_DIR="/usr/local/share/template-files" -ARG DEFAULT_DATA_DIR="/usr/local/share/template-files/data" -ARG DEFAULT_CONF_DIR="/usr/local/share/template-files/config" -ARG DEFAULT_TEMPLATE_DIR="/usr/local/share/template-files/defaults" ARG PATH="/usr/local/etc/docker/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" ARG USER="root" @@ -66,10 +62,6 @@ ARG EXPOSE_PORTS ARG BUILD_VERSION ARG IMAGE_VERSION ARG WWW_ROOT_DIR -ARG DEFAULT_FILE_DIR -ARG DEFAULT_DATA_DIR -ARG DEFAULT_CONF_DIR -ARG DEFAULT_TEMPLATE_DIR ARG DISTRO_VERSION ARG NODE_VERSION ARG NODE_MANAGER @@ -118,7 +110,7 @@ COPY --from=gosu /usr/local/bin/gosu /usr/local/bin/gosu RUN echo "Initializing the system"; \ $SHELL_OPTS; \ - mkdir -p "${DEFAULT_DATA_DIR}" "${DEFAULT_CONF_DIR}" "${DEFAULT_TEMPLATE_DIR}" "/root/docker/setup" "/etc/profile.d"; \ + mkdir -p "/root/docker/setup" "/etc/profile.d"; \ if [ -f "/root/docker/setup/00-init.sh" ];then echo "Running the init script";/root/docker/setup/00-init.sh||{ echo "Failed to execute /root/docker/setup/00-init.sh" >&2 && exit 10; };echo "Done running the init script";fi; \ echo "" @@ -229,10 +221,6 @@ ARG BUILD_VERSION ARG IMAGE_VERSION ARG GIT_COMMIT ARG WWW_ROOT_DIR -ARG DEFAULT_FILE_DIR -ARG DEFAULT_DATA_DIR -ARG DEFAULT_CONF_DIR -ARG DEFAULT_TEMPLATE_DIR ARG DISTRO_VERSION ARG NODE_VERSION ARG NODE_MANAGER diff --git a/README.md b/README.md index 68e7bf6..6586900 100644 --- a/README.md +++ b/README.md @@ -299,7 +299,7 @@ docker build --tag casjaysdev/go:test . ## 📄 License -MIT — see [LICENSE.md](LICENSE.md) +WTFPL — see [LICENSE.md](LICENSE.md) --- diff --git a/rootfs/etc/profile.d/go.sh b/rootfs/tmp/etc/profile.d/go.sh similarity index 100% rename from rootfs/etc/profile.d/go.sh rename to rootfs/tmp/etc/profile.d/go.sh diff --git a/rootfs/usr/local/bin/copy b/rootfs/usr/local/bin/copy index e9878d8..782f9dc 100755 --- a/rootfs/usr/local/bin/copy +++ b/rootfs/usr/local/bin/copy @@ -20,7 +20,7 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - # shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2090,SC2115,SC2120,SC2155,SC2199,SC2229,SC2317,SC2329 # - - - - - - - - - - - - - - - - - - - - - - - - - -APPNAME="$(basename -- "$0" 2>/dev/null)" +APPNAME="${0##*/}" # - - - - - - - - - - - - - - - - - - - - - - - - - # colorization if [ -n "$NO_COLOR" ]; then @@ -56,6 +56,8 @@ __copy() { DEFAULT_COLOR="254" COPY_EXIT_STATUS=0 # - - - - - - - - - - - - - - - - - - - - - - - - - +trap '' EXIT +# - - - - - - - - - - - - - - - - - - - - - - - - - # Main application if [ $# -ne 2 ]; then __printf_color "USAGE: $APPNAME to from" "1" >&2 diff --git a/rootfs/usr/local/bin/healthcheck b/rootfs/usr/local/bin/healthcheck index 8dab380..3309e60 100755 --- a/rootfs/usr/local/bin/healthcheck +++ b/rootfs/usr/local/bin/healthcheck @@ -20,7 +20,7 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - # shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2090,SC2115,SC2120,SC2155,SC2199,SC2229,SC2317,SC2329 # - - - - - - - - - - - - - - - - - - - - - - - - - -APPNAME="$(basename -- "$0" 2>/dev/null)" +APPNAME="${0##*/}" VERSION="202605051654-git" # - - - - - - - - - - - - - - - - - - - - - - - - - # Defaults (env vars override built-ins, CLI flags override env vars) @@ -234,6 +234,8 @@ __check_file() { return 0 } # - - - - - - - - - - - - - - - - - - - - - - - - - +trap '' EXIT +# - - - - - - - - - - - - - - - - - - - - - - - - - # Run checks ran_any=0 [ -n "$HEALTHCHECK_URL" ] && { __check_http "$HEALTHCHECK_URL" "$HEALTHCHECK_HTTP_STATUS" "$HEALTHCHECK_TIMEOUT"; ran_any=1; } diff --git a/rootfs/usr/local/bin/symlink b/rootfs/usr/local/bin/symlink index ac2db15..cdad8a1 100755 --- a/rootfs/usr/local/bin/symlink +++ b/rootfs/usr/local/bin/symlink @@ -20,7 +20,7 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - # shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2090,SC2115,SC2120,SC2155,SC2199,SC2229,SC2317,SC2329 # - - - - - - - - - - - - - - - - - - - - - - - - - -APPNAME="$(basename -- "$0" 2>/dev/null)" +APPNAME="${0##*/}" # - - - - - - - - - - - - - - - - - - - - - - - - - # colorization if [ -n "$NO_COLOR" ]; then @@ -56,6 +56,8 @@ __ln_sf() { DEFAULT_COLOR="254" SYMLINK_EXIT_STATUS=0 # - - - - - - - - - - - - - - - - - - - - - - - - - +trap '' EXIT +# - - - - - - - - - - - - - - - - - - - - - - - - - # Main application if [ $# -ne 2 ]; then __printf_color "USAGE: $APPNAME from to" "2" >&2