mirror of
https://github.com/Dodelidoo-Labs/sonobarr.git
synced 2025-12-23 22:17:45 -05:00
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:
23
.dockerignore
Normal file
23
.dockerignore
Normal 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
70
.github/workflows/release-docker.yml
vendored
Normal 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 }}
|
||||
Reference in New Issue
Block a user