🚀 Showcase Website – CI/CD Docker Template
This repository is a production-ready template for deploying a static website using:
- Plain HTML / CSS / JavaScript
- Docker + Nginx
- Gitea Actions for CI/CD
- Automated build numbering
- Safe deployment with healthchecks & rollback
It is designed to be forked and reused as a starting point for real-world deployments.
📦 What’s included
- ✅ Simple showcase website
- ✅ Configurable Nginx container
- ✅ Dockerfile ready for production
- ✅ CI pipeline (build + tag + push)
- ✅ CD pipeline (deploy + healthcheck)
- ✅ Automatic rollback on failed deployment
📁 Repository structure
.
├── .gitea/
│ └── workflows/
│ └── ci.yml
├── assets/
│ ├── scripts/
│ └── styles/
├── docker/
│ ├── default.conf.template
│ └── nginx.conf
├── Dockerfile
├── index.html
└── README.md
🐳 Docker image
Image tags
Each build produces multiple tags:
| Tag | Description |
|---|---|
build-N |
Incremental build number with N as the build number (recommended for deployments) |
latest |
Pointer to most recent build |
🔁 CI/CD Pipeline Overview
CI (Build)
Triggered on push to main:
- Logs into the Docker registry
- Build Docker image
- Tag with:
build-N&latest - Push image to registry
CD (Deploy)
The deploy job:
- Connects to the server via SSH
- Logs into the Docker registry
- Pulls the new
build-Nimage - Starts the new
build-Ncontainer on a test port81 - Runs healthchecks
- If unhealthy
- Stops the new
build-Ncontainer - Exits the CD process (keeping the old container running)
- Stops the new
- If healthy → stop the new
build-Ncontainer and stop here- Stops the new
build-Ncontainer - Stops the new old container
- Starts the new
build-Ncontainer on the correct port80 - Remove the docker image of the old container
- Stops the new
This guarantees:
- No broken deployments
- Clear CI failure signal
- Easy rollback
❤️ Healthcheck
The container exposes:
GET /health
Expected response:
200 OK
ok
Used by:
- Docker healthchecks
- Deployment validation
🔐 Required Gitea Secrets & Variables
The following secrets and variables must be setup inside the destination repository.
Variables
| Variable | Description |
|---|---|
IMAGE_NAME |
Name of the docker image (built and deployed) |
REGISTRY_LOCATION |
Location of the image registery |
REGISTRY_ORGANIZATION |
Name of the organisation in the image registery |
PORT |
Port on which the site will be exposed on |
TEST_PORT |
Port on which the test container will be exposed on |
Secrets
| Secrets | Description |
|---|---|
REGISTRY_USER |
User used in order to log into the image registery |
REGISTRY_TOKEN |
Token (or password) used in order to log into the image registery |
PROD_SERVER_HOST |
Location of the production server host (must be reachable from GITEA) |
DEPLOY_USER |
User used in order to ssh into the production server |
DEPLOY_SSH_KEY |
SSH private key used in order to ssh into the production server |
Description
Languages
HTML
46.3%
CSS
34.6%
Dockerfile
9.9%
JavaScript
9.2%