From d3a0e53f6ee53388e15e6a3433c38c657e15ef48 Mon Sep 17 00:00:00 2001 From: "info@pi-farm.de" Date: Mon, 22 Jun 2026 10:44:10 +0000 Subject: [PATCH 01/21] =?UTF-8?q?nginx-default.conf=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nginx-default.conf | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 nginx-default.conf diff --git a/nginx-default.conf b/nginx-default.conf new file mode 100644 index 0000000..e0332bc --- /dev/null +++ b/nginx-default.conf @@ -0,0 +1,26 @@ +server { + listen 80 default_server; + root /var/www/nZEDb/www; + index index.php index.html index.htm; + + location / { + try_files $uri $uri/ @rewrites; + } + + location @rewrites { + rewrite ^/([^/\.]+)/([^/]+)/([^/]+)/? /index.php?page=$1&id=$2&subpage=$3 last; + rewrite ^/([^/\.]+)/([^/]+)/?$ /index.php?page=$1&id=$2 last; + rewrite ^/([^/\.]+)/?$ /index.php?page=$1 last; + } + + location ~ \.php$ { + include snippets/fastcgi-php.conf; + fastcgi_pass unix:/run/php/php7.4-fpm.sock; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + include fastcgi_params; + } + + location ~* \.(notif|nzb)$ { + deny all; + } +} \ No newline at end of file -- 2.54.0 From e3ffc2acf980e747317c90de663e4120da2a1f25 Mon Sep 17 00:00:00 2001 From: "info@pi-farm.de" Date: Mon, 22 Jun 2026 10:54:28 +0000 Subject: [PATCH 02/21] =?UTF-8?q?start.sh=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- start.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 start.sh diff --git a/start.sh b/start.sh new file mode 100644 index 0000000..35c7590 --- /dev/null +++ b/start.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +# Sicherstellen, dass das Verzeichnis für den PHP-Socket existiert +mkdir -p /run/php + +# Rechte für den Webserver-User setzen +chown -R www-data:www-data /var/www/nZEDb + +# PHP 7.4-FPM im Hintergrund starten +service php7.4-fpm start + +# Nginx im Vordergrund starten, um den Container aktiv zu halten +echo "nZEDb-Dienste erfolgreich gestartet." +exec nginx -g "daemon off;" \ No newline at end of file -- 2.54.0 From 7b57af8a13e62521782f8668b93ddc27549cee3d Mon Sep 17 00:00:00 2001 From: "info@pi-farm.de" Date: Mon, 22 Jun 2026 10:59:17 +0000 Subject: [PATCH 03/21] buildargs.env aktualisiert --- buildargs.env | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/buildargs.env b/buildargs.env index dad5f2a..849ae0b 100644 --- a/buildargs.env +++ b/buildargs.env @@ -1,9 +1,6 @@ ## BUILD STAGE BUILD_TAG=1.00 -BUILD_BASE_IMAGE=alpine:${BUILD_TAG} -## Examples for BUILD_BASE_IMAGE -# alpine:${BUILD_TAG} -# git.pi-farm.de/pi-farm/docker-baseimage-alpine:v${BUILD_TAG} +BUILD_BASE_IMAGE=ubuntu:${BUILD_TAG} #BUILD_ALPINE_ARCH_AMD64=x86_64 #BUILD_ALPINE_ARCH_AARCH64=aarch64 #BUILD_S6_ARCH_amd64=x86_64 @@ -15,12 +12,13 @@ BUILD_BASE_IMAGE=alpine:${BUILD_TAG} #BUILD_APP_USER=pi #BUILD_APP_GID=1000 ## ENV STAGE +ENV_DEBIAN_FRONTEND=noninteractive ENV_TZ=Europe/Berlin ENV_PUID=1000 ENV_PGID=1000 # VOL_CONFIG=./config:/config # VOL_DATA=./data:/data # PORT_WEB=8080:80 -#PUSH=gitea,dockerhub -DESCRIPTION="Example example example" - +PUSH=gitea +#,dockerhub +DESCRIPTION="nZEDb Docker-image" \ No newline at end of file -- 2.54.0 From 21a4c788e53400cf306ab8d5656175dc247105e8 Mon Sep 17 00:00:00 2001 From: "info@pi-farm.de" Date: Mon, 22 Jun 2026 11:01:41 +0000 Subject: [PATCH 04/21] buildargs.env aktualisiert --- buildargs.env | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/buildargs.env b/buildargs.env index 849ae0b..6f1a007 100644 --- a/buildargs.env +++ b/buildargs.env @@ -6,19 +6,19 @@ BUILD_BASE_IMAGE=ubuntu:${BUILD_TAG} #BUILD_S6_ARCH_amd64=x86_64 #BUILD_S6_ARCH_aarch64=aarch64 #BUILD_S6_OVERLAY_VERSION=3.2.0.2 -#BUILD_MAINTAINER=pi-farm -#BUILD_APP_VERSION=v${BUILD_TAG} -#BUILD_APP_NAME=basimage-alpine -#BUILD_APP_USER=pi -#BUILD_APP_GID=1000 +BUILD_MAINTAINER=pi-farm +BUILD_APP_VERSION=v${BUILD_TAG} +BUILD_APP_NAME=nzedb +BUILD_APP_USER=pi +BUILD_APP_GID=1000 ## ENV STAGE ENV_DEBIAN_FRONTEND=noninteractive ENV_TZ=Europe/Berlin ENV_PUID=1000 ENV_PGID=1000 # VOL_CONFIG=./config:/config -# VOL_DATA=./data:/data -# PORT_WEB=8080:80 +VOL_DATA=./data:/var/www/nZEDb +# PORT_WEB=8800:80 PUSH=gitea #,dockerhub DESCRIPTION="nZEDb Docker-image" \ No newline at end of file -- 2.54.0 From f535e5235835557da77b3b6b5632f23756a8cb28 Mon Sep 17 00:00:00 2001 From: "info@pi-farm.de" Date: Mon, 22 Jun 2026 11:05:17 +0000 Subject: [PATCH 05/21] Dockerfile aktualisiert --- Dockerfile | 54 +++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 47 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 07bb5b9..b8d345e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,14 +14,54 @@ LABEL org.opencontainers.image.title="${APP_NAME}" ENV TZ=${TZ} ENV USER=${APP_USER} -RUN apk add --no-cache tzdata ca-certificates +RUN apt-get update && apt-get install -y \ + nginx \ + php7.4-fpm \ + php7.4-cli \ + php7.4-mysql \ + php7.4-xml \ + php7.4-curl \ + php7.4-gd \ + php7.4-mbstring \ + php7.4-json \ + git \ + tmux \ + curl \ + unzip \ + && rm -rf /var/lib/apt/lists/* -WORKDIR /app -COPY ./config /app/config -COPY ./data /app/data +# nZEDb in das Web-Verzeichnis klonen +RUN git clone https://github.com/nZEDb/nZEDb.git /var/www/nZEDb -RUN adduser -D ${APP_USER} && chown -R ${APP_USER}:${APP_USER} /app +WORKDIR /var/www/nZEDb -USER ${APP_USER} +# ===================================================================== +# AUTOMATISCHE PATCHES (Updatesicher ins Image eingebrannt) +# ===================================================================== -CMD ["sh"] \ No newline at end of file +# 1. Systemweiten Git-Sicherheits-Fix setzen +RUN git config --system --add safe.directory /var/www/nZEDb + +# 2. Zeitzonen-Fehler in der DB.php patchen +RUN sed -i 's/\$result = \$this->queryDirect("SET time_zone = .*/\$result = true;/g' /var/www/nZEDb/nzedb/db/DB.php + +# 3. Zeitzonen-Fehler im Lithium-Framework (MySql.php) patchen +RUN sed -i 's/function timezone\(.*\){/function timezone\1{ return;/g' /var/www/nZEDb/app/extensions/adapter/data/source/database/MySql.php \ + && sed -i '/function timezone/!b;n;s/{/{ return;/' /var/www/nZEDb/app/extensions/adapter/data/source/database/MySql.php + +# ===================================================================== + +# Nginx-Konfiguration austauschen +COPY nginx-default.conf /etc/nginx/sites-enabled/default + +# Start-Skript einbinden und ausführbar machen +COPY start.sh /start.sh +RUN chmod +x /start.sh + +# Arbeitsverzeichnis definieren (deckt sich mit deinem Inspect) +WORKDIR /var/www/nZEDb + +# Port nach außen freigeben (wird via Compose auf 8800 gemappt) +EXPOSE 80 + +CMD ["/start.sh"] \ No newline at end of file -- 2.54.0 From 920d89e87be0263f28d490f06e12e96745c5e29c Mon Sep 17 00:00:00 2001 From: "info@pi-farm.de" Date: Mon, 22 Jun 2026 11:06:49 +0000 Subject: [PATCH 06/21] Dockerfile aktualisiert --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index b8d345e..b21db39 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Example Dockerfile for amd64 -ARG BASE_IMAGE=alpine:latest +ARG BASE_IMAGE FROM ${BASE_IMAGE} -- 2.54.0 From afb94c77314c4c2278ce515ac4d7b39e1d76bdd5 Mon Sep 17 00:00:00 2001 From: "info@pi-farm.de" Date: Mon, 22 Jun 2026 11:08:14 +0000 Subject: [PATCH 07/21] buildargs.env aktualisiert --- buildargs.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildargs.env b/buildargs.env index 6f1a007..c74924f 100644 --- a/buildargs.env +++ b/buildargs.env @@ -1,5 +1,5 @@ ## BUILD STAGE -BUILD_TAG=1.00 +BUILD_TAG=20.04 BUILD_BASE_IMAGE=ubuntu:${BUILD_TAG} #BUILD_ALPINE_ARCH_AMD64=x86_64 #BUILD_ALPINE_ARCH_AARCH64=aarch64 -- 2.54.0 From 63b903f4ca09f858eeadfd197e14335ed9556566 Mon Sep 17 00:00:00 2001 From: "info@pi-farm.de" Date: Mon, 22 Jun 2026 11:10:46 +0000 Subject: [PATCH 08/21] buildargs.env aktualisiert --- buildargs.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildargs.env b/buildargs.env index c74924f..1bc75cc 100644 --- a/buildargs.env +++ b/buildargs.env @@ -1,6 +1,6 @@ ## BUILD STAGE BUILD_TAG=20.04 -BUILD_BASE_IMAGE=ubuntu:${BUILD_TAG} +BUILD_BASE_IMAGE=ubuntu:20.04 #BUILD_ALPINE_ARCH_AMD64=x86_64 #BUILD_ALPINE_ARCH_AARCH64=aarch64 #BUILD_S6_ARCH_amd64=x86_64 -- 2.54.0 From f9787b2cece4977365bb351b016fb4aa4513481b Mon Sep 17 00:00:00 2001 From: "info@pi-farm.de" Date: Mon, 22 Jun 2026 11:12:36 +0000 Subject: [PATCH 09/21] Dockerfile aktualisiert --- Dockerfile | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index b21db39..8b94c91 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,4 @@ -# Example Dockerfile for amd64 -ARG BASE_IMAGE - -FROM ${BASE_IMAGE} +FROM ubuntu:20.04 ARG MAINTAINER ARG TZ -- 2.54.0 From bdc48fcb53e6f036d2b6b706493551a11f9367b6 Mon Sep 17 00:00:00 2001 From: "info@pi-farm.de" Date: Mon, 22 Jun 2026 11:45:57 +0000 Subject: [PATCH 10/21] Dockerfile aktualisiert --- Dockerfile | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8b94c91..3985a2a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,10 @@ FROM ubuntu:20.04 -ARG MAINTAINER -ARG TZ -ARG APP_NAME -ARG APP_USER - -LABEL maintainer="${MAINTAINER}" -LABEL org.opencontainers.image.title="${APP_NAME}" - -ENV TZ=${TZ} -ENV USER=${APP_USER} +# Non-interactive Mode für apt und Zeitzone setzen +ENV DEBIAN_FRONTEND=noninteractive +ENV TZ=Europe/Berlin +# System-Updates und alle benötigten PHP 7.4 Pakete + Tools installieren RUN apt-get update && apt-get install -y \ nginx \ php7.4-fpm \ -- 2.54.0 From 6493a688a7ac351dad2c9fd015de6276d1bcae6e Mon Sep 17 00:00:00 2001 From: "info@pi-farm.de" Date: Mon, 22 Jun 2026 11:46:11 +0000 Subject: [PATCH 11/21] Dockerfile.aarch64 aktualisiert --- Dockerfile.aarch64 | 67 +++++++++++++++++++++++++++++++++------------- 1 file changed, 49 insertions(+), 18 deletions(-) diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index f02657b..3985a2a 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -1,27 +1,58 @@ -# Example Dockerfile for arm64 -ARG BASE_IMAGE=alpine:latest +FROM ubuntu:20.04 -FROM ${BASE_IMAGE} +# Non-interactive Mode für apt und Zeitzone setzen +ENV DEBIAN_FRONTEND=noninteractive +ENV TZ=Europe/Berlin -ARG MAINTAINER -ARG TZ -ARG APP_NAME -ARG APP_USER +# System-Updates und alle benötigten PHP 7.4 Pakete + Tools installieren +RUN apt-get update && apt-get install -y \ + nginx \ + php7.4-fpm \ + php7.4-cli \ + php7.4-mysql \ + php7.4-xml \ + php7.4-curl \ + php7.4-gd \ + php7.4-mbstring \ + php7.4-json \ + git \ + tmux \ + curl \ + unzip \ + && rm -rf /var/lib/apt/lists/* -LABEL maintainer="${MAINTAINER}" -LABEL org.opencontainers.image.title="${APP_NAME}" +# nZEDb in das Web-Verzeichnis klonen +RUN git clone https://github.com/nZEDb/nZEDb.git /var/www/nZEDb -ENV TZ=${TZ} -ENV USER=${APP_USER} +WORKDIR /var/www/nZEDb -RUN apk add --no-cache tzdata ca-certificates +# ===================================================================== +# AUTOMATISCHE PATCHES (Updatesicher ins Image eingebrannt) +# ===================================================================== -WORKDIR /app -COPY ./config /app/config -COPY ./data /app/data +# 1. Systemweiten Git-Sicherheits-Fix setzen +RUN git config --system --add safe.directory /var/www/nZEDb -RUN adduser -D ${APP_USER} && chown -R ${APP_USER}:${APP_USER} /app +# 2. Zeitzonen-Fehler in der DB.php patchen +RUN sed -i 's/\$result = \$this->queryDirect("SET time_zone = .*/\$result = true;/g' /var/www/nZEDb/nzedb/db/DB.php -USER ${APP_USER} +# 3. Zeitzonen-Fehler im Lithium-Framework (MySql.php) patchen +RUN sed -i 's/function timezone\(.*\){/function timezone\1{ return;/g' /var/www/nZEDb/app/extensions/adapter/data/source/database/MySql.php \ + && sed -i '/function timezone/!b;n;s/{/{ return;/' /var/www/nZEDb/app/extensions/adapter/data/source/database/MySql.php -CMD ["sh"] \ No newline at end of file +# ===================================================================== + +# Nginx-Konfiguration austauschen +COPY nginx-default.conf /etc/nginx/sites-enabled/default + +# Start-Skript einbinden und ausführbar machen +COPY start.sh /start.sh +RUN chmod +x /start.sh + +# Arbeitsverzeichnis definieren (deckt sich mit deinem Inspect) +WORKDIR /var/www/nZEDb + +# Port nach außen freigeben (wird via Compose auf 8800 gemappt) +EXPOSE 80 + +CMD ["/start.sh"] \ No newline at end of file -- 2.54.0 From 944fa2b09aceec2e26d4691ea658703df6eb547d Mon Sep 17 00:00:00 2001 From: "info@pi-farm.de" Date: Mon, 22 Jun 2026 11:47:15 +0000 Subject: [PATCH 12/21] docker-compose.yml aktualisiert --- docker-compose.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 8b13789..54bc573 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1 +1,23 @@ +services: + nzedb-db: + image: mariadb:10.5 + container_name: nzedb-db + restart: unless-stopped + environment: + MYSQL_ROOT_PASSWORD: root_password_hier_aendern + MYSQL_DATABASE: nzedb + MYSQL_USER: nzedb + MYSQL_PASSWORD: db_password_hier_aendern + volumes: + - ./db-data:/var/lib/mysql + nzedb-app: + build: . + container_name: nzedb-app + restart: unless-stopped + ports: + - "8800:80" + depends_on: + - nzedb-db + volumes: + - ./nzedb-data:/var/www/nZEDb -- 2.54.0 From d33777209dfaae9e946c975c528f9a7cb0286bb0 Mon Sep 17 00:00:00 2001 From: "info@pi-farm.de" Date: Mon, 22 Jun 2026 11:47:50 +0000 Subject: [PATCH 13/21] =?UTF-8?q?.gitea/workflows/build-and-push.yaml=20ge?= =?UTF-8?q?l=C3=B6scht?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/build-and-push.yaml | 442 --------------------------- 1 file changed, 442 deletions(-) delete mode 100644 .gitea/workflows/build-and-push.yaml diff --git a/.gitea/workflows/build-and-push.yaml b/.gitea/workflows/build-and-push.yaml deleted file mode 100644 index 2bf286d..0000000 --- a/.gitea/workflows/build-and-push.yaml +++ /dev/null @@ -1,442 +0,0 @@ -on: - push: - branches: - - 'main' - tags: - - '*' - schedule: - - cron: '0 5 * * 0' - workflow_dispatch: - -jobs: - release-and-build: - runs-on: buildx-multiarch - if: "!contains(gitea.event.head_commit.message, '[skip ci]')" - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Prepare Environment and Read Config - id: prep - run: | - export TZ=Europe/Berlin - - set -a - source <(grep -v '^#' buildargs.env | sed 's/\r$//') - set +a - - echo "push_targets=$PUSH" >> $GITHUB_OUTPUT - - ARGS_HASH=$(grep "^BUILD_" buildargs.env | sha256sum | cut -d' ' -f1) - echo "build_args_hash=$ARGS_HASH" >> $GITHUB_OUTPUT - - echo "event_name=${{ gitea.event_name }}" >> $GITHUB_OUTPUT - - if [[ "${{ gitea.ref }}" == refs/tags/* ]]; then - CLEAN_TAG=${{ gitea.ref_name }} - echo "docker_tag=${CLEAN_TAG#v}" >> $GITHUB_OUTPUT - else - echo "docker_tag=${BUILD_TAG:-latest}" >> $GITHUB_OUTPUT - fi - - OWNER=$(echo "${{ gitea.repository }}" | cut -d'/' -f1 | tr '[:upper:]' '[:lower:]') - REPO_NAME=$(echo "${{ gitea.repository }}" | cut -d'/' -f2 | tr '[:upper:]' '[:lower:]') - - echo "repo_pure=$REPO_NAME" >> $GITHUB_OUTPUT - echo "image_name=git.pi-farm.de/$OWNER/$REPO_NAME" >> $GITHUB_OUTPUT - echo "base_image=$BUILD_BASE_IMAGE" >> $GITHUB_OUTPUT - - - name: Login to Gitea Registry - run: | - echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login \ - git.pi-farm.de -u ${{ secrets.REGISTRY_USER }} --password-stdin - - - name: Check for Real Changes - id: check_changes - shell: bash - run: | - SHOULD_BUILD="true" - IMAGE="${{ steps.prep.outputs.image_name }}" - TAG="${{ steps.prep.outputs.docker_tag }}" - BASE="${{ steps.prep.outputs.base_image }}" - LOCAL_ARGS_HASH="${{ steps.prep.outputs.build_args_hash }}" - - echo "🔍 Check Remote-Registry..." - - if [[ "${{ steps.prep.outputs.event_name }}" != "schedule" ]]; then - echo "🚀 Start: Build forced." - else - REMOTE_BASE_SHA=$(docker buildx imagetools inspect "$BASE" --format '{{json .Manifest.Digest}}' 2>/dev/null | tr -d '"' || echo "") - - if [ -z "$REMOTE_BASE_SHA" ]; then - echo "⚠️ Base-Image SHA not readable. Build process started." - else - RAW_INDEX=$(docker buildx imagetools inspect "$IMAGE:$TAG" --raw 2>/dev/null || echo "") - - if [ -z "$RAW_INDEX" ]; then - echo "🆕 Image doesn't exist. Build required." - else - USED_BASE_SHA=$(echo "$RAW_INDEX" | grep "\"pi_farm.base_digest\":" | sed -E 's/.*: "([^"]+)".*/\1/' || echo "none") - USED_ARGS_HASH=$(echo "$RAW_INDEX" | grep "\"pi_farm.args_hash\":" | sed -E 's/.*: "([^"]+)".*/\1/' || echo "none") - - if [ "$REMOTE_BASE_SHA" == "$USED_BASE_SHA" ] && [ "$LOCAL_ARGS_HASH" == "$USED_ARGS_HASH" ]; then - echo "😴 All identic. Build not neccessary." - SHOULD_BUILD="false" - else - echo "✅ Build neccessary." - SHOULD_BUILD="true" - fi - fi - fi - fi - echo "should_build=$SHOULD_BUILD" >> $GITHUB_OUTPUT - - - name: Set up QEMU - if: steps.check_changes.outputs.should_build == 'true' - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - if: steps.check_changes.outputs.should_build == 'true' - uses: docker/setup-buildx-action@v3 - - - name: Login to Docker Hub - if: contains(steps.prep.outputs.push_targets, 'dockerhub') - uses: https://github.com/docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build and Push Docker Image - if: steps.check_changes.outputs.should_build == 'true' - run: | - IMAGE_GITEA=${{ steps.prep.outputs.image_name }} - TAG=${{ steps.prep.outputs.docker_tag }} - ARGS_HASH=${{ steps.prep.outputs.build_args_hash }} - BASE=${{ steps.prep.outputs.base_image }} - REPO_PURE=${{ steps.prep.outputs.repo_pure }} - - set -a - source <(grep -v '^#' buildargs.env | sed 's/\r$//') - set +a - - DOCKER_ARGS=() - keys=$(grep -v '^#' buildargs.env | cut -d'=' -f1 | tr -d '\r') - for k in $keys; do - DOCKER_ARGS+=("--build-arg" "$k=${!k}") - done - - BASE_SHA=$(docker buildx imagetools inspect $BASE --format '{{json .Manifest.Digest}}' 2>/dev/null | tr -d '"' || echo "unknown") - - AMD_TAGS=("-t" "$IMAGE_GITEA:tmp-amd64") - ARM_TAGS=("-t" "$IMAGE_GITEA:tmp-arm64") - - if [[ "$PUSH" == *"dockerhub"* ]]; then - DOCKERHUB_REPO="${{ secrets.DOCKERHUB_USERNAME }}/$REPO_PURE" - AMD_TAGS+=("-t" "$DOCKERHUB_REPO:tmp-amd64") - ARM_TAGS+=("-t" "$DOCKERHUB_REPO:tmp-arm64") - fi - - docker buildx build "${DOCKER_ARGS[@]}" "${AMD_TAGS[@]}" \ - --pull --platform linux/amd64 -f Dockerfile \ - --label "pi_farm.base_digest=$BASE_SHA" --label "pi_farm.args_hash=$ARGS_HASH" --push . - - docker buildx build "${DOCKER_ARGS[@]}" "${ARM_TAGS[@]}" \ - --pull --platform linux/arm64 -f Dockerfile.aarch64 \ - --label "pi_farm.base_digest=$BASE_SHA" --label "pi_farm.args_hash=$ARGS_HASH" --push . - - docker buildx imagetools create \ - --annotation "index:pi_farm.base_digest=$BASE_SHA" --annotation "index:pi_farm.args_hash=$ARGS_HASH" \ - -t $IMAGE_GITEA:$TAG -t $IMAGE_GITEA:latest $IMAGE_GITEA:tmp-amd64 $IMAGE_GITEA:tmp-arm64 - - if [[ "$PUSH" == *"dockerhub"* ]]; then - DOCKERHUB_REPO="${{ secrets.DOCKERHUB_USERNAME }}/$REPO_PURE" - docker buildx imagetools create \ - --annotation "index:pi_farm.base_digest=$BASE_SHA" --annotation "index:pi_farm.args_hash=$ARGS_HASH" \ - -t $DOCKERHUB_REPO:$TAG -t $DOCKERHUB_REPO:latest $IMAGE_GITEA:tmp-amd64 $IMAGE_GITEA:tmp-arm64 - fi - - - name: Update Documentation and Compose - id: update_doc - if: steps.check_changes.outputs.should_build == 'true' - run: | - set -x - - # --- 1. VARIABLEN VORBEREITEN --- - export TZ=Europe/Berlin - CURRENT_TIME=$(date '+%d.%m.%Y %H:%M') - BUILD_TAG="${{ steps.prep.outputs.docker_tag }}" - FULL_URL="${{ steps.prep.outputs.image_name }}" - REPO_PURE="${{ steps.prep.outputs.repo_pure }}" - BASE_IMAGE="${{ steps.prep.outputs.base_image }}" - - if [ ! -f "buildargs.env" ]; then echo "❌ buildargs.env missing!"; exit 1; fi - - grep -v '^#' buildargs.env | sed 's/\r$//' > cleaned_env.sh - set -a - source ./cleaned_env.sh - set +a - - if [ -f "Dockerfile.aarch64" ]; then ARM_STATUS="✅ Active"; else ARM_STATUS="❌ Not supported"; fi - - cat << 'EOF' > commit_msg.txt - ${{ gitea.event.head_commit.message }} - EOF - COMMIT_MSG=$(sed 's/\[skip ci\]//g' commit_msg.txt | xargs) - - # --- 2. TEMPLATES LADEN --- - wget -q https://git.pi-farm.de/pi-farm/templates/raw/branch/main/README.template -O README.template || echo "Warnung: README Template fehlt" - wget -q https://git.pi-farm.de/pi-farm/templates/raw/branch/main/docker-compose.template -O docker-compose.template || echo "Warnung: Compose Template fehlt" - - # --- 3. VERSION HISTORY --- - NEW_ROW="| **$BUILD_TAG** | $CURRENT_TIME | $COMMIT_MSG ✅ |" - if [ -f "VERSION.history" ]; then - grep -v "| **$BUILD_TAG** |" VERSION.history > VERSION.history.tmp || true - echo "$NEW_ROW" > VERSION.history - cat VERSION.history.tmp >> VERSION.history - rm VERSION.history.tmp - else - echo "$NEW_ROW" > VERSION.history - fi - HISTORY_CONTENT=$(cat VERSION.history) - - ENV_BLOCK_CONTENT="" - env_vars=$(grep '^ENV_' buildargs.env | grep -v '^#' | tr -d '\r' || true) - if [ -n "$env_vars" ]; then - ENV_BLOCK_CONTENT=" environment:\n" - while read -r line; do - [ -z "$line" ] && continue - key=$(echo "$line" | cut -d= -f1); val=$(echo "$line" | cut -d= -f2-); clean_key=${key#ENV_} - ENV_BLOCK_CONTENT="${ENV_BLOCK_CONTENT} - ${clean_key}=${val}\n" - done <<< "$env_vars" - fi - - PORTS_BLOCK_CONTENT="" - port_vars=$(grep '^PORT_' buildargs.env | grep -v '^#' | tr -d '\r' || true) - if [ -n "$port_vars" ]; then - PORTS_BLOCK_CONTENT=" ports:\n" - while read -r line; do - [ -z "$line" ] && continue - val=$(echo "$line" | cut -d= -f2-); PORTS_BLOCK_CONTENT="${PORTS_BLOCK_CONTENT} - ${val}\n" - done <<< "$port_vars" - fi - - VOL_BLOCK_CONTENT="" - vol_vars=$(grep '^VOL_' buildargs.env | grep -v '^#' | tr -d '\r' || true) - if [ -n "$vol_vars" ]; then - VOL_BLOCK_CONTENT=" volumes:\n" - while read -r line; do - [ -z "$line" ] && continue - val=$(echo "$line" | cut -d= -f2-); VOL_BLOCK_CONTENT="${VOL_BLOCK_CONTENT} - ${val}\n" - done <<< "$vol_vars" - fi - - # --- 5. DOCKER RUN BEFEHL (NEU: Als Datei schreiben) --- - # Wir schreiben direkt in eine Datei. Da gibt es keine Interpretationsfehler. - # Wichtig: " \\" am Ende der Zeilen explizit hinschreiben. - { - echo "docker run -d \\" - echo " --name $REPO_PURE \\" - echo " --restart unless-stopped \\" - - all_params=$(grep -E '^(PORT_|ENV_|VOL_)' buildargs.env | grep -v '^#' | sed 's/\r$//' || true) - if [ -n "$all_params" ]; then - while read -r line; do - [ -z "$line" ] && continue - if [[ "$line" =~ ^PORT_ ]]; then - val=$(echo "$line" | cut -d= -f2-) - echo " -p ${val} \\" - elif [[ "$line" =~ ^ENV_ ]]; then - key=$(echo "$line" | cut -d= -f1); clean_key=${key#ENV_}; val=$(echo "$line" | cut -d= -f2-) - echo " -e ${clean_key}=${val} \\" - elif [[ "$line" =~ ^VOL_ ]]; then - val=$(echo "$line" | cut -d= -f2-) - echo " -v ${val} \\" - fi - done <<< "$all_params" - fi - # Letzte Zeile OHNE Backslash - echo " $FULL_URL:$BUILD_TAG" - } > docker_run_block.txt - - # --- 6. DOCKER HUB LINK --- - DOCKERHUB_LINK_CONTENT="" - if [[ "${{ steps.prep.outputs.push_targets }}" == *"dockerhub"* ]]; then - DH_USER="${{ secrets.DOCKERHUB_USERNAME }}" - DOCKERHUB_LINK_CONTENT="[![Docker Hub](https://img.shields.io/badge/docker-hub-blue?logo=docker&logoColor=white)](https://hub.docker.com/r/${DH_USER}/${REPO_PURE})" - fi - - # --- 7. TEMPLATE ENGINE (Optimiert für File-Injection) --- - process_template() { - local template=$1; local output=$2 - [ ! -f "$template" ] && return - cp "$template" "$output" - - # Simple Ersetzungen - sed -i "s|__REPO_NAME__|$REPO_PURE|g" "$output" - sed -i "s|__FULL_URL__|$FULL_URL|g" "$output" - sed -i "s|__BUILD_TAG__|$BUILD_TAG|g" "$output" - sed -i "s|__BASE_IMAGE__|$BASE_IMAGE|g" "$output" - sed -i "s|__ARM_STATUS__|$ARM_STATUS|g" "$output" - sed -i "s|__CURRENT_DATE__|$CURRENT_TIME|g" "$output" - - # Komplexe Blöcke: AWK für Strings, SED für Files - awk -v r="$HISTORY_CONTENT" '{gsub(/__HISTORY_CONTENT__/, r)}1' "$output" > "$output.tmp" && mv "$output.tmp" "$output" - awk -v r="$DOCKERHUB_LINK_CONTENT" '{gsub(/__DOCKERHUB_LINK__/, r)}1' "$output" > "$output.tmp" && mv "$output.tmp" "$output" - - # NEU: Docker Run Block via File einfügen (sicherste Methode) - if grep -q "__DOCKER_RUN__" "$output" && [ -f "docker_run_block.txt" ]; then - sed -e '/__DOCKER_RUN__/{r docker_run_block.txt' -e 'd;}' "$output" > "$output.tmp" && mv "$output.tmp" "$output" - fi - - # Compose Block via File einfügen - if grep -q "__COMPOSE_BLOCK__" "$output" && [ -f "docker-compose.yml" ]; then - sed -e '/__COMPOSE_BLOCK__/{r docker-compose.yml' -e 'd;}' "$output" > "$output.tmp" && mv "$output.tmp" "$output" - fi - - # ENV/PORTS/VOL Blöcke - if grep -q "__ENV_BLOCK__" "$output"; then - awk -v r="$(echo -e "$ENV_BLOCK_CONTENT")" '{gsub(/__ENV_BLOCK__/, r)}1' "$output" > "$output.tmp" && mv "$output.tmp" "$output" - fi - awk -v r="$(echo -e "$PORTS_BLOCK_CONTENT")" '{gsub(/__PORTS_BLOCK__/, r)}1' "$output" > "$output.tmp" && mv "$output.tmp" "$output" - awk -v r="$(echo -e "$VOL_BLOCK_CONTENT")" '{gsub(/__VOL_BLOCK__/, r)}1' "$output" > "$output.tmp" && mv "$output.tmp" "$output" - - # Description als letztes - if grep -q "__DESCRIPTION__" "$output"; then - awk -v r="$(echo -e "${DESCRIPTION:-Keine Beschreibung.}")" '{gsub(/__DESCRIPTION__/, r)}1' "$output" > "$output.tmp" && mv "$output.tmp" "$output" - fi - } - - process_template "docker-compose.template" "docker-compose.yml" - process_template "README.template" "README.md" - - # --- 8. EXPORTS --- - echo "FINAL_MSG=$COMMIT_MSG" >> $GITHUB_ENV - echo "DESCRIPTION<> $GITHUB_ENV - echo -e "$DESCRIPTION" >> $GITHUB_ENV - echo "EOF" >> $GITHUB_ENV - - - name: Push README to Docker Hub - if: steps.check_changes.outputs.should_build == 'true' && contains(steps.prep.outputs.push_targets, 'dockerhub') - run: | - if ! command -v jq &> /dev/null; then - apt-get update && apt-get install -y jq || apk add --no-cache jq || true - fi - - echo "🚀 Starting update README on Docker Hub..." - - TOKEN=$(curl -s -X POST "https://hub.docker.com/v2/users/login/" \ - -H "Content-Type: application/json" \ - -d "{\"username\": \"${{ secrets.DOCKERHUB_USERNAME }}\", \"password\": \"${{ secrets.DOCKERHUB_TOKEN }}\"}" | jq -r .token) - - if [ "$TOKEN" == "null" ] || [ -z "$TOKEN" ]; then - echo "❌ Error: No login-token available. Check your credentials!" - exit 1 - fi - - REPO_PURE="${{ steps.prep.outputs.repo_pure }}" - DH_USER="${{ secrets.DOCKERHUB_USERNAME }}" - - SHORT_DESC=$(echo -e "${{ env.DESCRIPTION }}" | head -n 1 | cut -c 1-100) - [ -z "$SHORT_DESC" ] && SHORT_DESC="Docker Image for $REPO_PURE" - - echo "📦 Processing README.md (${REPO_PURE})..." - - jq -n \ - --arg desc "$SHORT_DESC" \ - --rawfile full_desc README.md \ - '{description: $desc, full_description: $full_desc}' > payload.json - - echo "📤 Sending data to Docker Hub API..." - RESPONSE=$(curl -s -w "\n%{http_code}" -X PATCH \ - "https://hub.docker.com/v2/repositories/${DH_USER}/${REPO_PURE}/" \ - -H "Authorization: JWT ${TOKEN}" \ - -H "Content-Type: application/json" \ - -d @payload.json) - - HTTP_STATUS=$(echo "$RESPONSE" | tail -n 1) - BODY=$(echo "$RESPONSE" | head -n -1) - - if [ "$HTTP_STATUS" -eq 200 ]; then - echo "✅ README update successfull (HTTP 200)." - else - echo "❌ Error on update! HTTP Status: $HTTP_STATUS" - echo "Answer from Docker Hub: $BODY" - exit 1 - fi - - - name: Commit, Tag and Push Changes - if: steps.check_changes.outputs.should_build == 'true' - run: | - git config --local user.email "action@pi-farm.de" - git config --local user.name "Gitea Action" - - # Sicherstellen, dass wir etwas zum Committen haben - git add VERSION.history README.md docker-compose.yml - - # Nur committen, wenn es Änderungen gibt - git diff --quiet && git diff --staged --quiet || git commit -m "${{ env.FINAL_MSG }} [skip ci]" - - # Das Tag exakt so setzen, wie es in prep definiert wurde (ohne extra 'v') - TARGET_TAG="${{ steps.prep.outputs.docker_tag }}" - git tag -f "$TARGET_TAG" - - if [[ "${{ gitea.ref }}" == refs/tags/* ]]; then - echo "🏷️ Build aus Tag getriggert: $TARGET_TAG" - # Wir pushen das Tag (force), um die Doku-Updates einzuschließen - git push -f origin "$TARGET_TAG" - else - echo "🌿 Build aus Branch/Schedule getriggert: ${{ gitea.ref_name }}" - # In den Branch pushen (HEAD:branch_name) und das Tag setzen - git push origin HEAD:${{ gitea.ref_name }} - git push -f origin "$TARGET_TAG" - fi - - - name: Cleanup Temporary Tags on Docker Hub - if: steps.check_changes.outputs.should_build == 'true' && contains(steps.prep.outputs.push_targets, 'dockerhub') - run: | - if ! command -v jq &> /dev/null; then - (apt-get update && apt-get install -y jq) || (apk add --no-cache jq) || true - fi - - echo "🧹 Cleanup temp. Docker Hub tags..." - - TOKEN=$(curl -s -X POST "https://hub.docker.com/v2/users/login/" \ - -H "Content-Type: application/json" \ - -d "{\"username\": \"${{ secrets.DOCKERHUB_USERNAME }}\", \"password\": \"${{ secrets.DOCKERHUB_TOKEN }}\"}" | jq -r .token) - - if [ "$TOKEN" != "null" ] && [ -n "$TOKEN" ]; then - REPO_PURE=${{ steps.prep.outputs.repo_pure }} - DH_USER="${{ secrets.DOCKERHUB_USERNAME }}" - - for t in tmp-amd64 tmp-arm64; do - echo "Deleting tag $t..." - STATUS=$(curl -s -o /dev/null -w "%{http_code}" -X DELETE \ - "https://hub.docker.com/v2/repositories/${DH_USER}/${REPO_PURE}/tags/$t/" \ - -H "Authorization: JWT ${TOKEN}") - echo "Status: $STATUS" - done - echo "✅ Temp. tags deleted." - fi - - - name: Cleanup Temporary Registry Tags (Gitea) - if: steps.check_changes.outputs.should_build == 'true' - run: | - TOKEN="${{ secrets.GIT_TOKEN }}" - ORG_NAME=$(echo "${{ gitea.repository }}" | cut -d'/' -f1) - REPO_NAME=$(echo "${{ gitea.repository }}" | cut -d'/' -f2) - - for t in tmp-amd64 tmp-arm64; do - curl -s -X DELETE "https://git.pi-farm.de/api/v1/packages/$ORG_NAME/container/$REPO_NAME/$t" -H "Authorization: token $TOKEN" - curl -s -X DELETE "https://git.pi-farm.de/api/v1/packages/${ORG_NAME,,}/container/${REPO_NAME,,}/$t" -H "Authorization: token $TOKEN" - done - - - name: Cleanup Docker Artifacts - if: always() - run: docker image prune -f - - - name: Workflow Summary - if: always() - run: | - echo "Check completed. Build was: ${{ steps.check_changes.outputs.should_build }}" \ No newline at end of file -- 2.54.0 From d1c025f490bb8cf28cc7d02fa358e6df39edc3bb Mon Sep 17 00:00:00 2001 From: "info@pi-farm.de" Date: Mon, 22 Jun 2026 11:48:40 +0000 Subject: [PATCH 14/21] =?UTF-8?q?db-data/.gitkeep=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db-data/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 db-data/.gitkeep diff --git a/db-data/.gitkeep b/db-data/.gitkeep new file mode 100644 index 0000000..e69de29 -- 2.54.0 From 2fe0455094967271d62c4a6f2d40217a40537b55 Mon Sep 17 00:00:00 2001 From: "info@pi-farm.de" Date: Mon, 22 Jun 2026 11:49:10 +0000 Subject: [PATCH 15/21] =?UTF-8?q?nzedb-data/.gitkeep=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nzedb-data/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 nzedb-data/.gitkeep diff --git a/nzedb-data/.gitkeep b/nzedb-data/.gitkeep new file mode 100644 index 0000000..e69de29 -- 2.54.0 From ad1a17987b418235465efe8510403395cf68946d Mon Sep 17 00:00:00 2001 From: "info@pi-farm.de" Date: Mon, 22 Jun 2026 11:49:25 +0000 Subject: [PATCH 16/21] =?UTF-8?q?data/.gitkeep=20gel=C3=B6scht?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 data/.gitkeep diff --git a/data/.gitkeep b/data/.gitkeep deleted file mode 100644 index e69de29..0000000 -- 2.54.0 From 9ec507e773e82668d603241a22bfc033d46220e0 Mon Sep 17 00:00:00 2001 From: "info@pi-farm.de" Date: Mon, 22 Jun 2026 11:49:33 +0000 Subject: [PATCH 17/21] =?UTF-8?q?config/.gitkeep=20gel=C3=B6scht?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 config/.gitkeep diff --git a/config/.gitkeep b/config/.gitkeep deleted file mode 100644 index e69de29..0000000 -- 2.54.0 From 8324f854b3a886126e440d336d0eef1e44d0d80a Mon Sep 17 00:00:00 2001 From: "info@pi-farm.de" Date: Mon, 22 Jun 2026 11:49:48 +0000 Subject: [PATCH 18/21] =?UTF-8?q?buildargs.env=20gel=C3=B6scht?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildargs.env | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100644 buildargs.env diff --git a/buildargs.env b/buildargs.env deleted file mode 100644 index 1bc75cc..0000000 --- a/buildargs.env +++ /dev/null @@ -1,24 +0,0 @@ -## BUILD STAGE -BUILD_TAG=20.04 -BUILD_BASE_IMAGE=ubuntu:20.04 -#BUILD_ALPINE_ARCH_AMD64=x86_64 -#BUILD_ALPINE_ARCH_AARCH64=aarch64 -#BUILD_S6_ARCH_amd64=x86_64 -#BUILD_S6_ARCH_aarch64=aarch64 -#BUILD_S6_OVERLAY_VERSION=3.2.0.2 -BUILD_MAINTAINER=pi-farm -BUILD_APP_VERSION=v${BUILD_TAG} -BUILD_APP_NAME=nzedb -BUILD_APP_USER=pi -BUILD_APP_GID=1000 -## ENV STAGE -ENV_DEBIAN_FRONTEND=noninteractive -ENV_TZ=Europe/Berlin -ENV_PUID=1000 -ENV_PGID=1000 -# VOL_CONFIG=./config:/config -VOL_DATA=./data:/var/www/nZEDb -# PORT_WEB=8800:80 -PUSH=gitea -#,dockerhub -DESCRIPTION="nZEDb Docker-image" \ No newline at end of file -- 2.54.0 From 8ce906814a1f91b8677f12f2412dbfbf812ba805 Mon Sep 17 00:00:00 2001 From: "info@pi-farm.de" Date: Mon, 22 Jun 2026 11:52:45 +0000 Subject: [PATCH 19/21] =?UTF-8?q?VERSION.history=20gel=C3=B6scht?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VERSION.history | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 VERSION.history diff --git a/VERSION.history b/VERSION.history deleted file mode 100644 index e69de29..0000000 -- 2.54.0 From 0c69bb164dd11458cdca200ec83431b1cf297d0d Mon Sep 17 00:00:00 2001 From: "info@pi-farm.de" Date: Mon, 22 Jun 2026 11:55:38 +0000 Subject: [PATCH 20/21] README.md aktualisiert --- README.md | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index f452a48..2b8ef77 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,8 @@ -# Projekt: {{.RepoName}} [![Build Status](https://git.pi-farm.de/{{.Owner.Name}}/{{.RepoName}}/actions/workflows/build-and-push.yaml/badge.svg)](https://git.pi-farm.de/{{.Owner.Name}}/{{.RepoName}}/actions) +# Projekt: nZEDb -This repository is built and pushed automatically. -### 🏗️ Platform Support -| Architecture | Status | Base-Image | -| :--- | :--- | :--- | -| **x86_64** (amd64) | ✅ Active | `__BASE_IMAGE__` | -| **aarch64** (arm64) | __ARM_STATUS__ | `__BASE_IMAGE__` | ### 🚀 Docker Pull Command ```bash -docker pull git.pi-farm.de/{{.Owner.Name}}/{{.RepoName}}:latest +docker pull git.pi-farm.de/pi-farm/nZEDb:latest ``` ---- -*Last updated on: __DATE__* -- 2.54.0 From ae75f52ff6813aa7df1f790061ee4aad2b486130 Mon Sep 17 00:00:00 2001 From: "info@pi-farm.de" Date: Mon, 22 Jun 2026 11:56:38 +0000 Subject: [PATCH 21/21] README.md aktualisiert --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2b8ef77..135b96d 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ -### 🚀 Docker Pull Command +### 🚀 Docker build command ```bash -docker pull git.pi-farm.de/pi-farm/nZEDb:latest +docker compose build ``` -- 2.54.0