CI/CD Pipeline for Angular Application Deployment
An end-to-end CI/CD deployment project that automatically builds an Angular application into a self-contained Docker image and runs it on my homelab, using self-hosted Gitea, Gitea Actions, Docker Compose and Cloudflare Tunnel.
The project connects software development with self-managed infrastructure. A code change pushed to the main branch automatically triggers a Gitea Actions workflow that builds a production image of this website and replaces the running container.
The image contains everything the site needs, so nothing is copied to or mounted from the server's folders. The container is made publicly accessible through a Cloudflare Tunnel.
Deployment Flow
CI/CD Workflow
The workflow (.gitea/workflows/ci-cd.yaml) has three jobs. It moved here from GitLab CI in November 2026 when I migrated the platform to Gitea:
1. Build Check
On pull requests, the Docker runner on the workstation VM installs the dependencies and builds the Angular application with the production configuration, so a broken change is caught before it reaches main.
2. Deployment
On main, the deploy job runs on apps-host, a Gitea runner in host mode on the Debian app VM, so it drives the same Docker daemon that serves the site.
The pipeline:
- Builds the Docker image, compiling the Angular application inside it.
- Replaces the running container only once the image has built, so a failed build leaves the live site untouched.
- Checks that the site answers before the job reports success.
- Prunes superseded images and old build cache so the server's disk does not fill up.
Because the build happens inside the image, no artifacts need to pass between jobs, and the deploy job needs nothing from the build check.
3. Code quality
Every push also runs a SonarQube scan in parallel. It reports bugs, code smells and security hotspots to my SonarQube server, and never blocks the deploy.
Packaging Angular in Docker
After the Angular application is compiled, the generated production files need to be served by a web server. A multi-stage Dockerfile does both steps.
Multi-Stage Dockerfile
The first stage uses Node.js to compile the application. The second stage starts from the lightweight Alpine-based Nginx image and copies in only the compiled files and the Nginx configuration:
Node.js, the source code and node_modules stay in the build stage, so the final image only contains what is needed to serve the site.
Nginx Configuration
Angular handles routing in the browser, so Nginx must return index.html for any path that is not a real file. Compiled assets are cached by the browser for a year:
Docker Compose Configuration
Docker Compose builds the image from the repository and publishes the container's port on the host:
There are no volumes. Earlier versions copied the build into a folder on the server and bind-mounted it, together with the Nginx configuration, into the container. Baking both into the image makes each deployment a single self-contained artifact and removes files on the host that could drift out of sync.
Publishing Through Cloudflare Tunnel
cloudflared runs on the Debian app VM and forwards requests for labjom.com to the container's port on the host. No ports are opened on the router, and Cloudflare provides HTTPS.
The result is this website, live and served from my homelab:

Technologies Used
- Angular
- Node.js
- Git
- Self-hosted Gitea
- Gitea Actions (act_runner, Docker and host mode)
- SonarQube
- Docker (multi-stage builds)
- Docker Compose
- Nginx
- Linux
- Cloudflare Tunnel
What This Project Demonstrates
This project demonstrates an end-to-end software delivery workflow built on self-managed infrastructure.
A developer can push code to the Gitea repository, triggering an automated pipeline that builds the Angular application into a Docker image and replaces the running container.
The final application is securely published from the homelab through Cloudflare Tunnel.
The project demonstrates the integration of software engineering, Linux administration, containerization, networking and DevOps automation, and how to make deployments self-contained, safe to fail and light on server storage.