Manage containerization and deployment automation using Docker, Kubernetes, and cloud platforms...
Design and implement containerization and deployment automation for Brainarr, enabling easy distribution, deployment, and scaling across diverse environments.
.github/workflows/ci.yml - Extracts from ghcr.io/hotio/lidarr:pr-plugins-3.1.2.4913docs/deployment/ - Docker Compose examples (not automated)docs/deployment/ - Dockerfile examples (not automated)FROM ghcr.io/hotio/lidarr:pr-plugins-3.1.2.4913
LABEL org.opencontainers.image.source="https://github.com/RicherTunes/brainarr"
LABEL org.opencontainers.image.description="Lidarr with Brainarr AI plugin pre-installed"
LABEL org.opencontainers.image.licenses="MIT"
# Copy plugin files
COPY --chown=hotio:hotio artifacts/plugin/ /config/plugins/RicherTunes/Brainarr/
# Add health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD curl -f http://localhost:8686/ping || exit 1
EXPOSE 8686
ENTRYPOINT ["/init"]
Benefits:
FROM alpine:latest
LABEL org.opencontainers.image.source="https://github.com/RicherTunes/brainarr"
LABEL org.opencontainers.image.description="Brainarr plugin files for mounting into Lidarr"
# Create plugin directory structure
RUN mkdir -p /plugin/RicherTunes/Brainarr
# Copy plugin artifacts
COPY artifacts/plugin/ /plugin/RicherTunes/Brainarr/
# Create volume for mounting
VOLUME ["/plugin"]
# Use scratch base for minimal size
FROM scratch
COPY --from=0 /plugin /plugin
VOLUME ["/plugin"]
Benefits:
# In .github/workflows/release.yml
- name: Build and push multi-arch image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: |
ghcr.io/richertunes/brainarr:${{ env.VERSION }}
ghcr.io/richertunes/brainarr:latest
latest - Latest stable releasev1.3.1 - Specific versionv1.3 - Minor version trackv1 - Major version trackdevelop - Development branchpr-123 - Pull request buildssha-abc123 - Commit SHA buildsversion: '3.9'
services:
lidarr:
image: ghcr.io/richertunes/lidarr-brainarr:latest
container_name: lidarr-brainarr
environment:
- PUID=1000
- PGID=1000
- TZ=America/New_York
- BRAINARR_API_KEY=${BRAINARR_API_KEY}
volumes:
- ./config:/config
- ./music:/music
- ./downloads:/downloads
ports:
- "8686:8686"
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8686/ping"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
apiVersion: apps/v1
kind: Deployment
metadata:
name: lidarr-brainarr
labels:
app: lidarr
plugin: brainarr
spec:
replicas: 1
selector:
matchLabels:
app: lidarr
template:
metadata:
labels:
app: lidarr
spec:
containers:
- name: lidarr
image: ghcr.io/richertunes/lidarr-brainarr:v1.3.1
ports:
- containerPort: 8686
env:
- name: PUID
value: "1000"
- name: PGID
value: "1000"
volumeMounts:
- name: config
mountPath: /config
- name: music
mountPath: /music
livenessProbe:
httpGet:
path: /ping
port: 8686
initialDelaySeconds: 60
periodSeconds: 30
volumes:
- name: config
persistentVolumeClaim:
claimName: lidarr-config
- name: music
persistentVolumeClaim:
claimName: music-library
helm/brainarr/
āāā Chart.yaml
āāā values.yaml
āāā templates/
ā āāā deployment.yaml
ā āāā service.yaml
ā āāā ingress.yaml
ā āāā configmap.yaml
ā āāā secret.yaml
āāā README.md
name: Container Build and Publish
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract version
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/richertunes/brainarr:${{ steps.version.outputs.VERSION }}
ghcr.io/richertunes/brainarr:latest
cache-from: type=gha
cache-to: type=gha,mode=max
Problem: Docker image is 500MB+ Solutions:
Problem: Build takes 10+ minutes Solutions:
Problem: Plugin files not readable in container Solutions:
Problem: Container marked unhealthy Solutions:
release-automation - Integrate container builds in releasesartifact-manager - Manage container images as artifactsobservability - Add monitoring to deployed containersUser: "Create a Docker image that includes Lidarr and Brainarr" Action:
User: "Automatically publish Docker images on release" Action:
User: "Create a Helm chart for Kubernetes deployment" Action:
helm install brainarr ./helm/brainarr