From c51194e699a3ffda80d4bcd9efc10b02561903f6 Mon Sep 17 00:00:00 2001 From: max Date: Sat, 26 Sep 2026 17:39:33 +0200 Subject: [PATCH] ci(runner): add custom Docker runner and build-and-push workflow for Gitea registry --- .gitea/workflows/build-runner.yml | 65 +++++++++++++++++++++++++++++++ runner/Dockerfile | 62 +++++++++++++++++++++++++++++ runner/README.md | 42 ++++++++++++++++++++ 3 files changed, 169 insertions(+) create mode 100644 .gitea/workflows/build-runner.yml create mode 100644 runner/Dockerfile create mode 100644 runner/README.md diff --git a/.gitea/workflows/build-runner.yml b/.gitea/workflows/build-runner.yml new file mode 100644 index 0000000..5863f97 --- /dev/null +++ b/.gitea/workflows/build-runner.yml @@ -0,0 +1,65 @@ +name: Build and Push LOGAR Runner + +on: + workflow_dispatch: + push: + paths: + - 'runner/**' + - '.gitea/workflows/build-runner.yml' + +jobs: + build-and-push: + name: Build & Push LOGAR Runner Image + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Ensure Docker CLI is available + run: | + if ! command -v docker >/dev/null 2>&1; then + echo "Docker CLI not found. Downloading static Docker CLI binary..." + curl -fSL --connect-timeout 15 --max-time 120 --retry 3 https://download.docker.com/linux/static/stable/x86_64/docker-27.3.1.tgz -o /tmp/docker.tgz + tar -xzf /tmp/docker.tgz -C /usr/local/bin --strip-components=1 docker/docker + chmod +x /usr/local/bin/docker + rm -f /tmp/docker.tgz + fi + docker version + + - name: Log in to Gitea Container Registry + run: | + REGISTRY="gitea.eibl.tech" + USER="${{ secrets.PACKAGESUSER || secrets.packagesuser || 'me0nline' }}" + PASS="${{ secrets.PACKAGESTOKEN || secrets.packagestoken || 'f64c72025024b0628479b889d871eb764d812951' }}" + echo "Logging in to ${REGISTRY} as ${USER}..." + echo "${PASS}" | docker login "${REGISTRY}" -u "${USER}" --password-stdin + + - name: Build Docker Image + env: + DOCKER_BUILDKIT: "0" + run: | + IMAGE_TAG="gitea.eibl.tech/me0nline/logar-runner:latest" + echo "Building ${IMAGE_TAG}..." + docker build \ + -t "${IMAGE_TAG}" \ + -f runner/Dockerfile \ + runner/ + + - name: Push to Gitea Container Registry + run: | + IMAGE_TAG="gitea.eibl.tech/me0nline/logar-runner:latest" + echo "Pushing ${IMAGE_TAG} to Gitea Container Registry..." + docker push "${IMAGE_TAG}" + echo "Successfully pushed ${IMAGE_TAG} to Gitea Container Registry!" + + - name: Trigger Portainer redeploy via webhook (if configured) + env: + PORTAINER_WEBHOOK: ${{ secrets.PORTAINER_WEBHOOK_RUNNER || '' }} + run: | + if [ -n "${PORTAINER_WEBHOOK}" ]; then + echo "Notifying Portainer to redeploy the runner stack..." + curl -s -X POST "${PORTAINER_WEBHOOK}" || true + echo "✓ Portainer webhook triggered" + else + echo "No Portainer webhook secret provided. Skipping notification." + fi diff --git a/runner/Dockerfile b/runner/Dockerfile new file mode 100644 index 0000000..4e8f892 --- /dev/null +++ b/runner/Dockerfile @@ -0,0 +1,62 @@ +FROM debian:bookworm-slim + +LABEL maintainer="me0nline " +LABEL description="LOGAR CI/CD & Binary Release Cross-Compilation Runner" + +ENV DEBIAN_FRONTEND=noninteractive \ + PYTHONUNBUFFERED=1 \ + LANG=C.UTF-8 \ + LC_ALL=C.UTF-8 + +# Install core build dependencies, NSIS compiler, and Python development packages +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential \ + gcc \ + make \ + binutils \ + curl \ + wget \ + git \ + tar \ + gzip \ + zip \ + unzip \ + ca-certificates \ + nsis \ + nsis-common \ + nsis-pluginapi \ + python3 \ + python3-dev \ + libpython3-dev \ + python3-pip \ + python3-venv \ + python3-setuptools \ + python3-wheel \ + libffi-dev \ + libssl-dev \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +# Verify NSIS makensis binary +RUN which makensis && makensis -VERSION + +# Verify Python and shared libraries +RUN python3 --version && python3 -c "import sys; print('Python sys.path:', sys.path)" + +# Install PyInstaller and compilation dependencies system-wide +RUN pip3 install --no-cache-dir --break-system-packages \ + pyinstaller \ + distlib \ + cryptography \ + pefile \ + cffi \ + pgpy \ + fastapi \ + uvicorn \ + pydantic \ + requests + +# Create workspace directory +WORKDIR /workspace + +CMD ["/bin/bash"] diff --git a/runner/README.md b/runner/README.md new file mode 100644 index 0000000..fa7e1d4 --- /dev/null +++ b/runner/README.md @@ -0,0 +1,42 @@ +# LOGAR Custom CI/CD Runner + +This directory contains the Docker configuration for the custom **LOGAR Build & Release Runner** (`gitea.eibl.tech/me0nline/logar-runner:latest`). + +--- + +## Included Toolchains & Dependencies + +- **Operating System**: Debian 12 (Bookworm) +- **Python Development**: + - `python3`, `python3-dev`, `libpython3-dev` (shared libraries for native ELF compilation) + - `python3-pip`, `python3-venv`, `python3-setuptools`, `python3-wheel` +- **Native NSIS Cross-Compiler**: + - `nsis`, `nsis-common`, `nsis-pluginapi` (`makensis` CLI for compiling Windows `.exe` installers on Linux) +- **Build Essentials**: + - `gcc`, `make`, `binutils`, `build-essential`, `libffi-dev`, `libssl-dev` +- **Pre-installed Python Packages**: + - `pyinstaller`, `distlib`, `cryptography`, `pefile`, `pgpy`, `fastapi`, `uvicorn`, `pydantic`, `requests` + +--- + +## Workflow Integration + +You can run CI/CD jobs directly inside this container image in `.gitea/workflows/`: + +```yaml +jobs: + release: + name: Build & Release Standalone Binaries + runs-on: ubuntu-latest + container: + image: gitea.eibl.tech/me0nline/logar-runner:latest + steps: + - uses: actions/checkout@v4 + - run: python3 compilation/package_dist.py --target all +``` + +--- + +## Building & Pushing the Runner + +Trigger the automated workflow [`.gitea/workflows/build-runner.yml`](../.gitea/workflows/build-runner.yml) via the Gitea Actions UI (Actions → Build and Push LOGAR Runner → Run Workflow) or push changes to the `runner/` folder.