CI/CD Pipeline for Docker Apps
Built a full production-style CI/CD loop for Dockerized homelab services: edit locally in VS Code, push to GitHub, and a self-hosted GitHub Actions runner on apps-node redeploys the container automatically. Every push to main deploys. The whole thing is one reusable template: the same workflow drops onto any Dockerized service. Today it deploys code-server; the hello-web demo it was built on was retired in October 2026.
git push. One deploy.yml pattern is reused across every Dockerized service in the homelab.
- deploy
git pushtomain→ container redeployed automatically- manual steps
- none: no SSH, no
docker composeby hand - deploy log
- git history: what changed, when, which commit
- reuse
- one
deploy.ymltemplate for any Dockerized service
The Problem
Deploying a change to any Dockerized service in the homelab meant the same manual ritual every time: SSH into apps-node, edit files in place or copy them up, then docker compose pull and docker compose up -d by hand. Fine for one service. Tedious and error-prone across a growing lab of them.
Before (Manual)
- SSH into the Docker host for every change
- Edit in place or copy files up by hand
- Manual
docker compose pull && up -d - No record of what deployed or when
- Each service redeployed differently
After (Automated)
- Edit locally in VS Code,
git push - GitHub Actions triggers on push to
main - Self-hosted runner redeploys automatically
- Git history is the deploy log
- One reusable workflow across all services
I wanted the same loop a real team uses — commit, push, automated deploy — without leaving the homelab network or exposing the Docker host to the internet.
The Solution
Pipeline Architecture
A self-hosted GitHub Actions runner lives on the same VM as the containers, so deploys happen locally on the Docker host — no inbound ports, no secrets shipped to a third-party builder.
┌─────────────────────────────────────────────────────────────────┐
│ CI/CD PIPELINE ARCHITECTURE │
├─────────────────────────────────────────────────────────────────┤
│ │
│ Local VS Code ──git push──► GitHub (repo + Actions) │
│ │ │ │
│ │ │ on: push → main │
│ │ ▼ │
│ ┌────────────────────────────────────────────────────────┐ │
│ │ Self-Hosted Runner on apps-node (systemd service) │ │
│ │ • actions/checkout@v4 │ │
│ │ • docker compose pull │ │
│ │ • docker compose up -d │ │
│ └────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ Container live ──► (optional) NGINX Proxy Manager │
│ → https://<app>.seggsy.co │
│ │
├─────────────────────────────────────────────────────────────────┤
│ Deploys code-server today (hello-web demo retired Oct 2026) │
└─────────────────────────────────────────────────────────────────┘
The Deploy Loop
Five moving parts, each doing one job:
- Local dev — GitHub Desktop + VS Code; commit and push from the workstation.
- GitHub — source of truth and the trigger surface.
- GitHub Actions — fires
deploy.ymlon every push tomain. - Self-hosted runner — runs the job on
apps-node, next to the containers. - Docker Compose — pulls the new image and recreates the service.
Implementation Details
Phase 1: Project Structure & Git
Each service gets its own folder under ~/docker on apps-node, initialized as a Git repo and pushed to GitHub:
# Create the service folder cd ~/docker mkdir <app-name> && cd <app-name> # add docker-compose.yml + config (html/, config/, …) # Initialize and push git init git remote add origin https://github.com/<username>/<repo>.git git add . git commit -m "initial commit" git push -u origin main
Phase 2: Install the Self-Hosted Runner
From the repo's Settings → Actions → Runners → New self-hosted runner (Linux / x64), I ran the generated commands on apps-node and installed the runner as a systemd service so it survives reboots:
cd ~ mkdir actions-runner && cd actions-runner # download + extract runner (GitHub provides exact commands) ./config.sh # Install & start as a service sudo ./svc.sh install sudo ./svc.sh start
Phase 3: The Deployment Workflow
The entire pipeline is one file — .github/workflows/deploy.yml — committed alongside the service:
name: deploy-<app-name>
on:
push:
branches:
- main
jobs:
deploy:
runs-on: self-hosted
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Deploy with Docker Compose
run: |
docker compose pull
docker compose up -d
Commit and push it, and GitHub Actions auto-deploys on every push to main from then on:
git add .github/workflows/deploy.yml git commit -m "add deploy workflow" git push
Phase 4: Verify the Deploy
After a push, confirm the container is running the latest content:
# Container is up $ docker ps --filter "name=<app-name>" # Content reflects the latest push $ curl http://127.0.0.1:<port> | head
If the output reflects the latest push, the loop is working end to end.
Design Decisions
The Decision:
The deploy job runs on a runner installed on apps-node itself, not on GitHub's cloud builders.
Why:
The Docker host lives on a private homelab network behind Tailscale — there are no inbound ports for a cloud builder to reach. Putting the runner on the host means the deploy happens locally, with direct access to the Docker socket and compose files, and no credentials or SSH access ever leave the network.
Trade-off:
A self-hosted runner is infrastructure I own and patch. Installing it as a systemd service keeps it running unattended, which is the point — but it's one more thing to keep healthy.
The Gotcha:
For NGINX Proxy Manager to route to a freshly deployed container, the container has to share NPM's Docker network. That network already exists, so Compose must join it as external — not define its own:
networks:
- proxy-net
networks:
proxy-net:
external: true
Then in NPM:
Add a proxy host — Domain <app>.seggsy.co, Forward Host <app-name>, Forward Port 80, scheme http — plus a NextDNS rewrite pointing <app>.seggsy.co at the NPM VM's IP.
Lesson Learned:
Forgetting external: true spins up a brand-new isolated network and NPM silently can't see the container. The container is "up" but unreachable — a confusing failure until you check which network it joined.
The Decision:
Rather than bespoke deploy scripts per service, every Dockerized app uses the same deploy.yml pattern with only the name changed.
Why:
Consistency. Onboarding a new service is copy the workflow, change the name, push. Nothing new to learn per app, and every service behaves identically when something breaks.
Results
- Every push to
mainredeploys the service automatically — no manual SSH, no manual compose - The runner runs as a systemd service, so deploys keep working after reboots with nobody logged in
- Git history doubles as the deploy log — what changed, when, and by which commit
- One reusable
deploy.ymlpattern works across every Dockerized service in the homelab
The Loop
Local VS Code → GitHub → GitHub Actions → Self-Hosted Runner → docker compose up -d
The Short Version
Deploying any Dockerized service in my homelab used to mean SSHing into apps-node, copying files up, and running docker compose pull && up -d by hand — fine for one service, tedious and inconsistent across a growing lab of them. I built a production-style CI/CD loop instead: a self-hosted GitHub Actions runner installed as a systemd service on the Docker host, plus a one-file deploy.yml workflow that triggers on every push to main and runs actions/checkout → docker compose pull → docker compose up -d. Now I edit locally in VS Code, push, and the container redeploys itself. Git history becomes the deploy log.
I chose a self-hosted runner specifically because the Docker host sits on a private network behind Tailscale — there's no inbound path for a cloud builder, and running the deploy locally means no SSH access or secrets ever leave the network. The one gotcha worth documenting: to expose a freshly deployed container through NGINX Proxy Manager, the Compose file has to join NPM's existing network as external: true — otherwise Compose creates a new isolated network and the container comes up healthy but unreachable. The whole thing is deliberately a template: copy deploy.yml, change the name, push, and any new service is on the same automated loop.