diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..0f24cb3 --- /dev/null +++ b/.dockerignore @@ -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 diff --git a/.github/workflows/release-docker.yml b/.github/workflows/release-docker.yml new file mode 100644 index 0000000..0fb1854 --- /dev/null +++ b/.github/workflows/release-docker.yml @@ -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 }} diff --git a/README.md b/README.md index 56b4d96..db1d565 100644 --- a/README.md +++ b/README.md @@ -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.