From c972a5982efc2c3cdb1d16918d449d70e3e3e3d9 Mon Sep 17 00:00:00 2001 From: Frank Agerholm Date: Wed, 4 Dec 2024 21:02:06 +0100 Subject: [PATCH 01/20] Create Image-Tag from CI_COMMIT_REF_SLUG --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a5f09de..e5d1966 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -37,8 +37,8 @@ deploy: - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY script: - docker pull $CI_REGISTRY_IMAGE:job-$CI_PIPELINE_ID - - docker tag $CI_REGISTRY_IMAGE:job-$CI_PIPELINE_ID $CI_REGISTRY_IMAGE:latest - - docker push $CI_REGISTRY_IMAGE:latest + - docker tag $CI_REGISTRY_IMAGE:job-$CI_PIPELINE_ID $CI_REGISTRY_IMAGE:${CI_COMMIT_REF_SLUG:-latest} + - docker push $CI_REGISTRY_IMAGE:${CI_COMMIT_REF_SLUG:-latest} include: - template: Security/SAST.gitlab-ci.yml - template: Security/Container-Scanning.gitlab-ci.yml From ce60b815c9d4097d59fee5e86b48cc07cb9adf40 Mon Sep 17 00:00:00 2001 From: Frank Agerholm Date: Wed, 4 Dec 2024 21:07:00 +0100 Subject: [PATCH 02/20] Add node- and npm-version output to test stage --- .gitlab-ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e5d1966..d3b6f8b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -27,6 +27,8 @@ test: stage: test image: "$CI_REGISTRY_IMAGE:job-$CI_PIPELINE_ID" script: + - node --version + - npm --version - python --version - nikola --version - pip --version @@ -38,6 +40,7 @@ deploy: script: - docker pull $CI_REGISTRY_IMAGE:job-$CI_PIPELINE_ID - docker tag $CI_REGISTRY_IMAGE:job-$CI_PIPELINE_ID $CI_REGISTRY_IMAGE:${CI_COMMIT_REF_SLUG:-latest} + - echo "deploying $CI_REGISTRY_IMAGE:${CI_COMMIT_REF_SLUG:-latest}" - docker push $CI_REGISTRY_IMAGE:${CI_COMMIT_REF_SLUG:-latest} include: - template: Security/SAST.gitlab-ci.yml From a85e2a090e1bd22d87ff8e98fa88f0fa9396b698 Mon Sep 17 00:00:00 2001 From: Frank Agerholm Date: Wed, 4 Dec 2024 21:09:55 +0100 Subject: [PATCH 03/20] Add nodejs and npm to image --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 74bd758..561e2bd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM docker.io/library/python:3.11-alpine -RUN apk --no-cache add sshpass openssh-client lftp; mkdir -p /opt/app +RUN apk --no-cache add sshpass openssh-client lftp nodejs npm; mkdir -p /opt/app WORKDIR /opt/app ADD requirements.txt /root/ ADD Dockerfile /root/ From ce035d918605f6402a62702c12086097bbc557cc Mon Sep 17 00:00:00 2001 From: Frank Agerholm Date: Wed, 4 Dec 2024 21:44:12 +0100 Subject: [PATCH 04/20] Add configuration-File support. --- README.md | 10 +++++++++ bin/build.sh | 57 +++++++++++++++++++++++++++++++++++++++++++-------- bin/deploy.sh | 16 +++++++++++++-- 3 files changed, 73 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 966be18..6e109e6 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,16 @@ This image is based on the python:3.11-alpine image and includes additional Python-packages for building nikola-sites. +## Configure your project + +Create a configuration file in your git-repo: `.deployment-helper` + +Configuration-Variables: + +* DEPLOY_HELPER_ENABLE_NIKOLA (default: true) +* DEPLOY_HELPER_ENABLE_NODE (default: false) +* DEPLOY_HELPER_CONTENT_DIR (default: "website/output") + ## lftp for sftp-Uploads This image includes `lftp` to upload files to a sftp-server and use diff --git a/bin/build.sh b/bin/build.sh index 727aa8f..d7f92e1 100644 --- a/bin/build.sh +++ b/bin/build.sh @@ -1,18 +1,59 @@ #!/bin/sh -if ! test -d website +# Default configurations: +DEPLOY_HELPER_ENABLE_NIKOLA=true +DEPLOY_HELPER_ENABLE_NODE=false + +if test -f .deployment-helper then - echo "Website directory not found" - exit 1 + # shellcheck source=/dev/null + . .deployment-helper fi -if ! command -v nikola >/dev/null 2>&1 + + +if $DEPLOY_HELPER_ENABLE_NODE then - echo "nikola command not found" - exit 1 + if ! command -v node >/dev/null 2>&1 + then + echo "node not found" 1>&2 + exit 1 + fi + if ! command -v npm >/dev/null 2>&1 + then + echo "npm not found" 1>&2 + exit 1 + fi + if ! test -d node + then + echo "Node directory not found" 1>&2 + exit 1 + fi + + cd node || { echo 'Directory "node" not found'; exit 1;} + if ! npm install + then + echo "Error installing node-dependencies" 1>&2 + exit 1 + fi + cd .. fi -cd website +if $DEPLOY_HELPER_ENABLE_NIKOLA +then + if ! test -d website + then + echo "Website directory not found" 1>&2 + exit 1 + fi -nikola build + if ! command -v nikola >/dev/null 2>&1 + then + echo "nikola command not found" 1>&2 + exit 1 + fi + cd website || { echo 'Directory "website" not found'; exit 1;} + nikola build + cd .. +fi exit "$?" diff --git a/bin/deploy.sh b/bin/deploy.sh index bdf78f1..154fa0f 100755 --- a/bin/deploy.sh +++ b/bin/deploy.sh @@ -1,7 +1,16 @@ #!/bin/sh +# Default configurations: +DEPLOY_HELPER_CONTENT_DIR="website/output" -if ! test -d website/output +if test -f .deployment-helper +then + # shellcheck source=/dev/null + . .deployment-helper +fi + + +if ! test -d "${DEPLOY_HELPER_CONTENT_DIR}" then echo "Website-Build not found" exit 1 @@ -16,6 +25,9 @@ then fi -lftp -e 'set sftp:auto-confirm yes; mirror -R ./website/output/ ./web/; bye' --env-password -u ${SSH_USER} sftp://${SSH_HOST} +lftp -e "set sftp:auto-confirm yes; mirror -R ${DEPLOY_HELPER_CONTENT_DIR} ./web/; bye" \ + --env-password \ + -u ${SSH_USER} \ + sftp://${SSH_HOST} From 9506e727addb1fb2b3be5dde50c837be61916230 Mon Sep 17 00:00:00 2001 From: Frank Agerholm Date: Wed, 4 Dec 2024 22:35:12 +0100 Subject: [PATCH 05/20] Build for nuxi based Websites --- bin/build.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/bin/build.sh b/bin/build.sh index d7f92e1..9311cd3 100644 --- a/bin/build.sh +++ b/bin/build.sh @@ -36,6 +36,23 @@ then echo "Error installing node-dependencies" 1>&2 exit 1 fi + if test -f nuxt.config.ts + then + # Build for nuxi based Sites + if ! npx nuxi build + then + echo "Error nuxi build" 1>&2 + exit 1 + fi + if ! npx nuxi generate + then + echo "Error nuxi generate" 1>&2 + exit 1 + fi + else + echo "No supportet node website type found" 1>&2 + exit 1 + fi cd .. fi From 1e4a46dc6e78ff9dd7da103e7f79759873d8764e Mon Sep 17 00:00:00 2001 From: Frank Agerholm Date: Fri, 5 Dec 2025 17:11:01 +0100 Subject: [PATCH 06/20] Additional Python dependencies added. --- requirements.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/requirements.txt b/requirements.txt index ca82f01..7516d19 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,3 +5,8 @@ Jinja2 aiohttp watchdog python-dotenv +rstcheck +docutils +esbonio +pytz +certifi-linux \ No newline at end of file From 8c13a92fa3d938da985153dfe2c568a5c9bd7742 Mon Sep 17 00:00:00 2001 From: Frank Agerholm Date: Fri, 5 Dec 2025 17:11:01 +0100 Subject: [PATCH 07/20] Additional Python dependencies added. --- requirements.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/requirements.txt b/requirements.txt index ca82f01..7516d19 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,3 +5,8 @@ Jinja2 aiohttp watchdog python-dotenv +rstcheck +docutils +esbonio +pytz +certifi-linux \ No newline at end of file From 23651e0e2eb3cbc29804c6c54650226d852a3503 Mon Sep 17 00:00:00 2001 From: Frank Agerholm Date: Sun, 18 Jan 2026 19:11:46 +0100 Subject: [PATCH 08/20] Download Let's Encrypt CA-Certificates --- Dockerfile | 8 +++ bin/fetch_letsencrypt_ca_certs.py | 109 ++++++++++++++++++++++++++++++ 2 files changed, 117 insertions(+) create mode 100755 bin/fetch_letsencrypt_ca_certs.py diff --git a/Dockerfile b/Dockerfile index 561e2bd..ea8ac0d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,9 @@ +FROM docker.io/library/python:3.11-alpine AS cabuilder +RUN apk add --no-cache ca-certificates +ADD bin/fetch_letsencrypt_ca_certs.py /usr/local/bin/fetch_letsencrypt_ca_certs.py +RUN /usr/local/bin/fetch_letsencrypt_ca_certs.py /usr/local/share/ca-certificates/ +RUN update-ca-certificates + FROM docker.io/library/python:3.11-alpine RUN apk --no-cache add sshpass openssh-client lftp nodejs npm; mkdir -p /opt/app @@ -5,9 +11,11 @@ WORKDIR /opt/app ADD requirements.txt /root/ ADD Dockerfile /root/ ADD bin/*.sh /usr/local/bin/ +COPY --from=cabuilder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt # ignore "Running pip as root" warning ENV PIP_ROOT_USER_ACTION=ignore +ENV REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt RUN chmod 755 /usr/local/bin/*.sh && pip install -r /root/requirements.txt && pip freeze && rm -Rf "$(pip cache dir)" diff --git a/bin/fetch_letsencrypt_ca_certs.py b/bin/fetch_letsencrypt_ca_certs.py new file mode 100755 index 0000000..85eb8f3 --- /dev/null +++ b/bin/fetch_letsencrypt_ca_certs.py @@ -0,0 +1,109 @@ +#!/usr/bin/env python3 + +import os +import sys +import requests +from html.parser import HTMLParser +from urllib.parse import urljoin + +LETSENCRYPT_CERT_PAGE = "https://letsencrypt.org/certificates/" +DEFAULT_TARGET_DIR = "./letsencrypt-ca" + + +class PemLinkParser(HTMLParser): + def __init__(self): + super().__init__() + self.pem_links = set() + + def handle_starttag(self, tag, attrs): + if tag.lower() != "a": + return + for attr, value in attrs: + if attr == "href" and value.lower().endswith(".pem"): + self.pem_links.add(value) + + +def fetch_certificate_page(): + resp = requests.get(LETSENCRYPT_CERT_PAGE, timeout=15) + resp.raise_for_status() + return resp.text + + +def extract_pem_links(html): + parser = PemLinkParser() + parser.feed(html) + return sorted( + urljoin(LETSENCRYPT_CERT_PAGE, link) + for link in parser.pem_links + ) + + +def download_and_store(url, target_dir): + base_name = os.path.basename(url) + # Zielname = .crt statt .pem + target_name = os.path.splitext(base_name)[0] + ".crt" + target_path = os.path.join(target_dir, target_name) + + if os.path.exists(target_path): + print(f"[=] Bereits vorhanden: {target_name}") + return target_name + + print(f"[+] Lade herunter: {base_name}") + resp = requests.get(url, timeout=15) + resp.raise_for_status() + + if b"BEGIN CERTIFICATE" not in resp.content: + print(f"[!] Ungültiges Zertifikat: {base_name}") + return None + + # Direkt als .crt speichern (PEM-Inhalt) + with open(target_path, "wb") as f: + f.write(resp.content) + + return target_name + + +def list_local_crt_files(target_dir): + return { + f for f in os.listdir(target_dir) + if f.lower().endswith(".crt") + } + + +def main(): + target_dir = sys.argv[1] if len(sys.argv) > 1 else DEFAULT_TARGET_DIR + os.makedirs(target_dir, exist_ok=True) + + print(f"[*] Zielverzeichnis: {os.path.abspath(target_dir)}") + print("[*] Format: PEM-Inhalt mit .crt-Endung") + + html = fetch_certificate_page() + pem_urls = extract_pem_links(html) + + # Remote-Dateinamen im .crt-Format + remote_files = { + os.path.splitext(os.path.basename(url))[0] + ".crt" + for url in pem_urls + } + + for url in pem_urls: + download_and_store(url, target_dir) + + local_files = list_local_crt_files(target_dir) + orphaned = sorted(local_files - remote_files) + + print("\n" + "=" * 60) + if orphaned: + print("[!] Lokal vorhanden, aber nicht mehr gelistet:") + for f in orphaned: + print(f" - {f}") + else: + print("[✓] Keine veralteten Dateien gefunden") + print("=" * 60) + print("[✓] Fertig.") + + +if __name__ == "__main__": + main() + + From 8333305c55d521fd2d2628204d40869d86cd56cf Mon Sep 17 00:00:00 2001 From: Frank Agerholm Date: Sun, 18 Jan 2026 19:31:23 +0100 Subject: [PATCH 09/20] =?UTF-8?q?Gitea=20Workflow=20eingef=C3=BCgt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/container.yml | 43 ++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .gitea/workflows/container.yml diff --git a/.gitea/workflows/container.yml b/.gitea/workflows/container.yml new file mode 100644 index 0000000..b6d0758 --- /dev/null +++ b/.gitea/workflows/container.yml @@ -0,0 +1,43 @@ +name: Build and Push Docker Image + +on: + push: + branches: [ main ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Login to Registry + uses: docker/login-action@v2 + with: + registry: ${GITHUB_SERVER_URL} + username: ${{ secrets.REGISTRY_USER }} + password: ${{ secrets.REGISTRY_PASSWORD }} + + - name: Build Docker Image + env: + BRANCH_NAME: ${{ github.ref_name }} + SHORT_HASH: ${{ github.sha }} + run: | + # Build the image with the commit hash tag + docker build --build-arg BUILD_IDENTIFIER=${SHORT_HASH:0:5} -t ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}:${BRANCH_NAME}-${SHORT_HASH:0:5} . + + # Tag the same image as "latest" + docker tag ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}:${BRANCH_NAME}-${SHORT_HASH:0:5} ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}:${BRANCH_NAME}-latest + + - name: Push Docker Images + env: + BRANCH_NAME: ${{ github.ref_name }} + SHORT_HASH: ${{ github.sha }} + run: | + docker push ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}:${BRANCH_NAME}-${SHORT_HASH:0:5} + docker push ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}:${BRANCH_NAME}-latest + + - name: Log out from registry + if: always() + run: docker logout ${GITHUB_SERVER_URL} + From ecba05f9e74a2e0fff704021af10b0dc94c38be9 Mon Sep 17 00:00:00 2001 From: Frank Agerholm Date: Sun, 18 Jan 2026 19:32:20 +0100 Subject: [PATCH 10/20] Allow actions on dev-Branch --- .gitea/workflows/container.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/container.yml b/.gitea/workflows/container.yml index b6d0758..7ada6ee 100644 --- a/.gitea/workflows/container.yml +++ b/.gitea/workflows/container.yml @@ -2,7 +2,7 @@ name: Build and Push Docker Image on: push: - branches: [ main ] + branches: [ main, dev ] jobs: build: From 497468c8e911447bfd92042cd9dba4bf9353fd71 Mon Sep 17 00:00:00 2001 From: Frank Agerholm Date: Sun, 18 Jan 2026 19:49:59 +0100 Subject: [PATCH 11/20] TLS-Verify for checkout-Action disabled. --- .gitea/workflows/container.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitea/workflows/container.yml b/.gitea/workflows/container.yml index 7ada6ee..df0454a 100644 --- a/.gitea/workflows/container.yml +++ b/.gitea/workflows/container.yml @@ -10,6 +10,8 @@ jobs: steps: - uses: actions/checkout@v4 + env: + GIT_SSL_NO_VERIFY: true - name: Login to Registry uses: docker/login-action@v2 From 943f488bbe17e1ba401a132aed4a332392dadae6 Mon Sep 17 00:00:00 2001 From: Frank Agerholm Date: Sun, 18 Jan 2026 19:53:27 +0100 Subject: [PATCH 12/20] New Workflow Variable REGISTRY_HOST (custom) --- .gitea/workflows/container.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/container.yml b/.gitea/workflows/container.yml index df0454a..31c4637 100644 --- a/.gitea/workflows/container.yml +++ b/.gitea/workflows/container.yml @@ -16,7 +16,7 @@ jobs: - name: Login to Registry uses: docker/login-action@v2 with: - registry: ${GITHUB_SERVER_URL} + registry: ${REGITRY_HOST} username: ${{ secrets.REGISTRY_USER }} password: ${{ secrets.REGISTRY_PASSWORD }} @@ -26,20 +26,20 @@ jobs: SHORT_HASH: ${{ github.sha }} run: | # Build the image with the commit hash tag - docker build --build-arg BUILD_IDENTIFIER=${SHORT_HASH:0:5} -t ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}:${BRANCH_NAME}-${SHORT_HASH:0:5} . + docker build --build-arg BUILD_IDENTIFIER=${SHORT_HASH:0:5} -t ${REGITRY_HOST}/${GITHUB_REPOSITORY}:${BRANCH_NAME}-${SHORT_HASH:0:5} . # Tag the same image as "latest" - docker tag ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}:${BRANCH_NAME}-${SHORT_HASH:0:5} ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}:${BRANCH_NAME}-latest + docker tag ${REGITRY_HOST}/${GITHUB_REPOSITORY}:${BRANCH_NAME}-${SHORT_HASH:0:5} ${REGITRY_HOST}/${GITHUB_REPOSITORY}:${BRANCH_NAME}-latest - name: Push Docker Images env: BRANCH_NAME: ${{ github.ref_name }} SHORT_HASH: ${{ github.sha }} run: | - docker push ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}:${BRANCH_NAME}-${SHORT_HASH:0:5} - docker push ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}:${BRANCH_NAME}-latest + docker push ${REGITRY_HOST}/${GITHUB_REPOSITORY}:${BRANCH_NAME}-${SHORT_HASH:0:5} + docker push ${REGITRY_HOST}/${GITHUB_REPOSITORY}:${BRANCH_NAME}-latest - name: Log out from registry if: always() - run: docker logout ${GITHUB_SERVER_URL} + run: docker logout ${REGITRY_HOST} From dc3ab7e3c0b4b3fcea07dddefac254b043baa43a Mon Sep 17 00:00:00 2001 From: Frank Agerholm Date: Sun, 18 Jan 2026 19:57:20 +0100 Subject: [PATCH 13/20] Workflow variables fixed --- .gitea/workflows/container.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/container.yml b/.gitea/workflows/container.yml index 31c4637..ad0b027 100644 --- a/.gitea/workflows/container.yml +++ b/.gitea/workflows/container.yml @@ -16,7 +16,7 @@ jobs: - name: Login to Registry uses: docker/login-action@v2 with: - registry: ${REGITRY_HOST} + registry: ${{ vars.REGITRY_HOST }} username: ${{ secrets.REGISTRY_USER }} password: ${{ secrets.REGISTRY_PASSWORD }} @@ -26,20 +26,20 @@ jobs: SHORT_HASH: ${{ github.sha }} run: | # Build the image with the commit hash tag - docker build --build-arg BUILD_IDENTIFIER=${SHORT_HASH:0:5} -t ${REGITRY_HOST}/${GITHUB_REPOSITORY}:${BRANCH_NAME}-${SHORT_HASH:0:5} . + docker build --build-arg BUILD_IDENTIFIER=${SHORT_HASH:0:5} -t ${{ vars.REGITRY_HOST }}/${GITHUB_REPOSITORY}:${BRANCH_NAME}-${SHORT_HASH:0:5} . # Tag the same image as "latest" - docker tag ${REGITRY_HOST}/${GITHUB_REPOSITORY}:${BRANCH_NAME}-${SHORT_HASH:0:5} ${REGITRY_HOST}/${GITHUB_REPOSITORY}:${BRANCH_NAME}-latest + docker tag ${{ vars.REGITRY_HOST }}/${GITHUB_REPOSITORY}:${BRANCH_NAME}-${SHORT_HASH:0:5} ${{ vars.REGITRY_HOST }}/${GITHUB_REPOSITORY}:${BRANCH_NAME}-latest - name: Push Docker Images env: BRANCH_NAME: ${{ github.ref_name }} SHORT_HASH: ${{ github.sha }} run: | - docker push ${REGITRY_HOST}/${GITHUB_REPOSITORY}:${BRANCH_NAME}-${SHORT_HASH:0:5} - docker push ${REGITRY_HOST}/${GITHUB_REPOSITORY}:${BRANCH_NAME}-latest + docker push ${{ vars.REGITRY_HOST }}/${GITHUB_REPOSITORY}:${BRANCH_NAME}-${SHORT_HASH:0:5} + docker push ${{ vars.REGITRY_HOST }}/${GITHUB_REPOSITORY}:${BRANCH_NAME}-latest - name: Log out from registry if: always() - run: docker logout ${REGITRY_HOST} + run: docker logout ${{ vars.REGITRY_HOST }} From 60231cb20d46cb3f44a8997b920217139b9b4d45 Mon Sep 17 00:00:00 2001 From: Frank Agerholm Date: Sun, 18 Jan 2026 19:58:44 +0100 Subject: [PATCH 14/20] Wofkload Typo fixed. --- .gitea/workflows/container.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/container.yml b/.gitea/workflows/container.yml index ad0b027..0b7d42a 100644 --- a/.gitea/workflows/container.yml +++ b/.gitea/workflows/container.yml @@ -16,7 +16,7 @@ jobs: - name: Login to Registry uses: docker/login-action@v2 with: - registry: ${{ vars.REGITRY_HOST }} + registry: ${{ vars.REGISTRY_HOST }} username: ${{ secrets.REGISTRY_USER }} password: ${{ secrets.REGISTRY_PASSWORD }} @@ -26,20 +26,20 @@ jobs: SHORT_HASH: ${{ github.sha }} run: | # Build the image with the commit hash tag - docker build --build-arg BUILD_IDENTIFIER=${SHORT_HASH:0:5} -t ${{ vars.REGITRY_HOST }}/${GITHUB_REPOSITORY}:${BRANCH_NAME}-${SHORT_HASH:0:5} . + docker build --build-arg BUILD_IDENTIFIER=${SHORT_HASH:0:5} -t ${{ vars.REGISTRY_HOST }}/${GITHUB_REPOSITORY}:${BRANCH_NAME}-${SHORT_HASH:0:5} . # Tag the same image as "latest" - docker tag ${{ vars.REGITRY_HOST }}/${GITHUB_REPOSITORY}:${BRANCH_NAME}-${SHORT_HASH:0:5} ${{ vars.REGITRY_HOST }}/${GITHUB_REPOSITORY}:${BRANCH_NAME}-latest + docker tag ${{ vars.REGISTRY_HOST }}/${GITHUB_REPOSITORY}:${BRANCH_NAME}-${SHORT_HASH:0:5} ${{ vars.REGISTRY_HOST }}/${GITHUB_REPOSITORY}:${BRANCH_NAME}-latest - name: Push Docker Images env: BRANCH_NAME: ${{ github.ref_name }} SHORT_HASH: ${{ github.sha }} run: | - docker push ${{ vars.REGITRY_HOST }}/${GITHUB_REPOSITORY}:${BRANCH_NAME}-${SHORT_HASH:0:5} - docker push ${{ vars.REGITRY_HOST }}/${GITHUB_REPOSITORY}:${BRANCH_NAME}-latest + docker push ${{ vars.REGISTRY_HOST }}/${GITHUB_REPOSITORY}:${BRANCH_NAME}-${SHORT_HASH:0:5} + docker push ${{ vars.REGISTRY_HOST }}/${GITHUB_REPOSITORY}:${BRANCH_NAME}-latest - name: Log out from registry if: always() - run: docker logout ${{ vars.REGITRY_HOST }} + run: docker logout ${{ vars.REGISTRY_HOST }} From 4de4c398c6da8d02610c8f8fbb13f0e6934183a9 Mon Sep 17 00:00:00 2001 From: Frank Agerholm Date: Sun, 18 Jan 2026 20:00:13 +0100 Subject: [PATCH 15/20] Build-Dependency py3-requests --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index ea8ac0d..8c6c4af 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ FROM docker.io/library/python:3.11-alpine AS cabuilder -RUN apk add --no-cache ca-certificates +RUN apk add --no-cache ca-certificates py3-requests ADD bin/fetch_letsencrypt_ca_certs.py /usr/local/bin/fetch_letsencrypt_ca_certs.py RUN /usr/local/bin/fetch_letsencrypt_ca_certs.py /usr/local/share/ca-certificates/ RUN update-ca-certificates From 9c9850395f5fd7c46360ed79ff4aef043c5b317c Mon Sep 17 00:00:00 2001 From: Frank Agerholm Date: Sun, 18 Jan 2026 20:11:14 +0100 Subject: [PATCH 16/20] Use Alpine 3.23 as cabuilder --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8c6c4af..65a69c2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ -FROM docker.io/library/python:3.11-alpine AS cabuilder -RUN apk add --no-cache ca-certificates py3-requests +FROM docker.io/library/alpine:v3:23 AS cabuilder +RUN apk add --no-cache ca-certificates py3 py3-requests ADD bin/fetch_letsencrypt_ca_certs.py /usr/local/bin/fetch_letsencrypt_ca_certs.py RUN /usr/local/bin/fetch_letsencrypt_ca_certs.py /usr/local/share/ca-certificates/ RUN update-ca-certificates From eada22fb21bdc7cfe85dd8bdd0c6b1864e6cdbfa Mon Sep 17 00:00:00 2001 From: Frank Agerholm Date: Sun, 18 Jan 2026 20:12:00 +0100 Subject: [PATCH 17/20] Dockerfile typo --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 65a69c2..0e0856b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM docker.io/library/alpine:v3:23 AS cabuilder +FROM docker.io/library/alpine:v3.23 AS cabuilder RUN apk add --no-cache ca-certificates py3 py3-requests ADD bin/fetch_letsencrypt_ca_certs.py /usr/local/bin/fetch_letsencrypt_ca_certs.py RUN /usr/local/bin/fetch_letsencrypt_ca_certs.py /usr/local/share/ca-certificates/ From 78a76a5a3f8c3c0b774beb5babbca6c50b8442ca Mon Sep 17 00:00:00 2001 From: Frank Agerholm Date: Sun, 18 Jan 2026 20:13:04 +0100 Subject: [PATCH 18/20] Dockerfile image version fixed --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 0e0856b..c4acf51 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM docker.io/library/alpine:v3.23 AS cabuilder +FROM docker.io/library/alpine:3.23 AS cabuilder RUN apk add --no-cache ca-certificates py3 py3-requests ADD bin/fetch_letsencrypt_ca_certs.py /usr/local/bin/fetch_letsencrypt_ca_certs.py RUN /usr/local/bin/fetch_letsencrypt_ca_certs.py /usr/local/share/ca-certificates/ From 9d59f0b31848c36910e627f3ad791899a529eafc Mon Sep 17 00:00:00 2001 From: Frank Agerholm Date: Sun, 18 Jan 2026 20:14:10 +0100 Subject: [PATCH 19/20] Alpine package name fixed. --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index c4acf51..4e0e9d0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ FROM docker.io/library/alpine:3.23 AS cabuilder -RUN apk add --no-cache ca-certificates py3 py3-requests +RUN apk add --no-cache ca-certificates python3 py3-requests ADD bin/fetch_letsencrypt_ca_certs.py /usr/local/bin/fetch_letsencrypt_ca_certs.py RUN /usr/local/bin/fetch_letsencrypt_ca_certs.py /usr/local/share/ca-certificates/ RUN update-ca-certificates From a545c66c3ea8f67a78c4c05ce0dfc96ac16dc513 Mon Sep 17 00:00:00 2001 From: Frank Agerholm Date: Fri, 23 Jan 2026 17:43:23 +0100 Subject: [PATCH 20/20] Configuration file example added. --- README.md | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 6e109e6..2c7e363 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # deployment-helper für Nikola based Websites -# ENV-Variables +## ENV-Variables * LFTP_PASSWORD (Deployment-Passwort for sftp-Upload) * SSH_HOST (Deployment-Host for sftp-Upload) @@ -13,13 +13,24 @@ Python-packages for building nikola-sites. ## Configure your project -Create a configuration file in your git-repo: `.deployment-helper` +| Variable | Default | Description | +| --------------------------- | --------------- | ---------------------------------------- | +| DEPLOY_HELPER_ENABLE_NIKOLA | true | Build Nikola-Website in `website/` | +| DEPLOY_HELPER_ENABLE_NODE | false | Enable nodejs Build in `node/` | +| DEPLOY_HELPER_CONTENT_DIR | website/output/ | Default Content-Directory for publishing | -Configuration-Variables: -* DEPLOY_HELPER_ENABLE_NIKOLA (default: true) -* DEPLOY_HELPER_ENABLE_NODE (default: false) -* DEPLOY_HELPER_CONTENT_DIR (default: "website/output") +Create a configuration file in your git-repo: `.deployment-helper`: + +``` +DEPLOY_HELPER_ENABLE_NIKOLA=false +DEPLOY_HELPER_ENABLE_NODE=true +DEPLOY_HELPER_CONTENT_DIR="node/.output/public/" +``` + +This example disables the niko build and enables node. The finished +website is copied from the `node/.output/public/` directory to the +target server. ## lftp for sftp-Uploads