Skip to content

Commit 9cb0bfb

Browse files
committed
support docker deployment
1 parent efc4b41 commit 9cb0bfb

File tree

6 files changed

+614
-7
lines changed

6 files changed

+614
-7
lines changed

.env.example

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Environment variables for mediagui Docker deployment
2+
3+
# Media folders to scan (comma-separated)
4+
MEDIA_FOLDERS=/media/movies,/media/tv
5+
6+
# Unraid hosts to monitor (comma-separated)
7+
UNRAID_HOSTS=unraid.local:8080
8+
9+
# User agent for API requests
10+
USER_AGENT=mediagui/1.0
11+
12+
# TMDB API key for movie metadata
13+
TMDB_KEY=your_tmdb_api_key_here
14+
15+
# Data directory for application files (default: /data in container)
16+
DATA_DIR=/data
17+
18+
# User and group IDs for file permissions
19+
USER_ID=1000
20+
GROUP_ID=1000

.github/workflows/docker-build.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Docker Build and Push
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
tags: [ 'v*' ]
7+
pull_request:
8+
branches: [ main ]
9+
10+
env:
11+
REGISTRY: ghcr.io
12+
IMAGE_NAME: ${{ github.repository }}
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
packages: write
20+
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Set up Docker Buildx
28+
uses: docker/setup-buildx-action@v3
29+
30+
- name: Log in to Container Registry
31+
if: github.event_name != 'pull_request'
32+
uses: docker/login-action@v3
33+
with:
34+
registry: ${{ env.REGISTRY }}
35+
username: ${{ github.actor }}
36+
password: ${{ secrets.GITHUB_TOKEN }}
37+
38+
- name: Extract metadata
39+
id: meta
40+
uses: docker/metadata-action@v5
41+
with:
42+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
43+
tags: |
44+
type=ref,event=branch
45+
type=ref,event=pr
46+
type=sha,prefix={{branch}}-
47+
type=semver,pattern={{version}}
48+
type=semver,pattern={{major}}.{{minor}}
49+
type=raw,value=latest,enable={{is_default_branch}}
50+
51+
- name: Generate version
52+
id: version
53+
run: |
54+
if [ "${{ github.event_name }}" == "push" ] && [[ "${{ github.ref }}" == refs/tags/* ]]; then
55+
VERSION="${{ github.ref_name }}"
56+
else
57+
MB_DATE=$(date '+%Y.%m.%d')
58+
MB_HASH=$(git rev-parse --short HEAD)
59+
VERSION="$MB_DATE-$MB_HASH"
60+
fi
61+
echo "version=$VERSION" >> $GITHUB_OUTPUT
62+
63+
- name: Build and push Docker image
64+
uses: docker/build-push-action@v5
65+
with:
66+
context: .
67+
platforms: linux/amd64
68+
push: ${{ github.event_name != 'pull_request' }}
69+
tags: ${{ steps.meta.outputs.tags }}
70+
labels: ${{ steps.meta.outputs.labels }}
71+
build-args: |
72+
VERSION=${{ steps.version.outputs.version }}
73+
cache-from: type=gha
74+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)