Adds Docker support and release workflow

### Added
- Dockerfile and .dockerignore for containerization.
- GitHub Actions workflow for automated Docker image builds and releases to GHCR on tag creation.
This commit is contained in:
Beda Schmid
2025-10-07 08:54:58 -03:00
parent 74d6a05f32
commit fd2b1cb350
3 changed files with 94 additions and 1 deletions

23
.dockerignore Normal file
View File

@@ -0,0 +1,23 @@
# Exclude unnecessary files from Docker build context
.git
.github
.gitignore
.DS_Store
README.md
LICENSE
*.md
docker-compose.yml
config
*.log
__pycache__
*.pyc
*.pyo
*.pyd
.pytest_cache
venv
env
.env
.sample-env
tests
tmp
node_modules

70
.github/workflows/release-docker.yml vendored Normal file
View File

@@ -0,0 +1,70 @@
name: Release Docker Image
on:
release:
types: [published]
permissions:
contents: read
packages: write
jobs:
build-and-push:
name: Build and push image to GHCR
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Prepare image name (lowercase)
id: prep
run: |
REPO_LC="${GITHUB_REPOSITORY,,}"
echo "IMAGE=ghcr.io/${REPO_LC}" >> $GITHUB_ENV
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE }}
# Use the release tag for image tags and generate semver variants if possible
tags: |
type=ref,event=tag
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
flavor: |
latest=false
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Add "latest" tag for releases from main
if: github.event.release.prerelease == false && github.event.release.target_commitish == 'main'
run: echo "EXTRA_TAGS=${{ env.IMAGE }}:latest" >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
push: true
platforms: linux/amd64,linux/arm64
tags: |
${{ steps.meta.outputs.tags }}
${{ env.EXTRA_TAGS }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
RELEASE_VERSION=${{ github.ref_name }}

View File

@@ -87,4 +87,4 @@ _This setup assumes you already use Docker and have a network (for example, with
This project is licensed under the MIT License.
Original work © 2024 TheWicklowWolf.
Forked and modified by Dodelidoo Labs, © 2025.
Modified by Dodelidoo Labs, © 2025.