From 363fd2d169ab1075ee4e139fdf43523eb08c7656 Mon Sep 17 00:00:00 2001 From: Arne Baeumler Date: Mon, 12 Jan 2026 20:28:59 +0100 Subject: [PATCH] fix: add Dockerfile and gitea ci pipeline --- .gitea/workflows/publish-docker.yml | 46 +++++++++++++++++++++++++++++ Dockerfile | 20 +++++++++++++ entrypoint.sh | 13 -------- requirements.txt | 2 +- webapp.initrc | 13 -------- 5 files changed, 67 insertions(+), 27 deletions(-) create mode 100644 .gitea/workflows/publish-docker.yml create mode 100644 Dockerfile delete mode 100755 entrypoint.sh delete mode 100755 webapp.initrc diff --git a/.gitea/workflows/publish-docker.yml b/.gitea/workflows/publish-docker.yml new file mode 100644 index 0000000..60ee8e8 --- /dev/null +++ b/.gitea/workflows/publish-docker.yml @@ -0,0 +1,46 @@ +--- +name: Build and Publish Docker Image +on: + push: + branches: + - main + tags: + - 'v*' + +jobs: + build-and-push: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Log in to Gitea Container Registry + uses: docker/login-action@v3 + with: + registry: git.br0tkasten.de + username: ${{ gitea.actor }} + # access token of the user triggering this action + # in gitea -> user settings -> applications -> new token -> write:packages and write:repositories + # then in gitea -> user settings -> actions -> secrets -> add new secret named "TOKEN" with the value of the access token. + password: ${{ secrets.TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: git.br0tkasten.de/${{ gitea.repository }} + flavor: | + latest=true + tags: | + type=ref,event=branch + type=semver,pattern={{version}} + type=sha + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..717934e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +# Use an official Python runtime as a parent image +FROM python:3-slim + +# Set the working directory in the container +WORKDIR /app + +# Copy the requirements file into the container +COPY requirements.txt . + +# Install any needed packages specified in requirements.txt +RUN pip install --no-cache-dir -r requirements.txt + +# Copy the current directory contents into the container at /app +COPY . . + +# Make port 9080 available to the world outside this container +EXPOSE 9080 + +# Run the application using Gunicorn +CMD ["python3", "app.py"] diff --git a/entrypoint.sh b/entrypoint.sh deleted file mode 100755 index 2006d9f..0000000 --- a/entrypoint.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -BASE=$(dirname $0) -cd $BASE -git pull -if [ -d env ]; -then - python3 -m venv env -fi - -source env/bin/activate -pip3 install -U -r requirements.txt -exec python3 app.py diff --git a/requirements.txt b/requirements.txt index 7a38911..14774b4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -websockets \ No newline at end of file +websockets diff --git a/webapp.initrc b/webapp.initrc deleted file mode 100755 index d3913ea..0000000 --- a/webapp.initrc +++ /dev/null @@ -1,13 +0,0 @@ -#!/sbin/openrc-run - -name="scratch-cloudvars-server" -command="/data/entrypoint.sh" -pidfile="/var/run/$SVCNAME.pid" -command_background="yes" -output_logger="/usr/bin/logger" -error_logger="/usr/bin/logger" - -depend() { - need net - use logger -} \ No newline at end of file