- JavaScript 86.2%
- Dockerfile 13.8%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .forgejo/workflows | ||
| test | ||
| .dockerignore | ||
| .gitignore | ||
| Dockerfile | ||
| package.json | ||
| README.md | ||
| server.js | ||
Forgejo CI/CD example
A dependency-free Node.js 24 HTTP application with a working Forgejo Actions
pipeline. GET / returns a greeting and version; GET /health reports health.
Pipeline
Every push to main, pull request, or manual run:
- Checks out the commit and runs four HTTP integration tests.
- Builds a Docker image tagged with that commit's SHA.
- Repeats the tests inside the built image.
- On
mainonly, deploys the image astaznado-ci-cd-exampleand checks both Docker health status and the running application's response.
The demo deployment runs inside the runner's dedicated Docker-in-Docker engine. It persists between jobs, has no published host ports, and is not a public website. No registry credentials, deployment secrets, or host Docker socket are required. Pull requests build and test without replacing the demo. The single-job runner serializes execution. This simple demo replaces its container on deployment; it does not provide production rollback or zero downtime.
Run locally
With Node.js 24 or later:
npm test
npm start
With Docker:
docker build -t forgejo-ci-cd-example .
docker run --rm forgejo-ci-cd-example npm test
docker run --rm -p 3000:3000 forgejo-ci-cd-example
Open http://localhost:3000/ or /health.
Runner requirements
Enable Actions and register a runner with these labels:
runner:
capacity: 1
labels:
- ubuntu-latest:docker://node:24-bookworm
- docker:docker://docker:28-cli
The runner must execute jobs in a dedicated Docker engine and expose that engine
to job steps through DOCKER_HOST. Use only trusted workflows with access to
this engine. In this installation the runner is restricted to this repository.
The ubuntu-latest label uses a Debian-based Node image, not a full GitHub runner.
To inspect the deployed app on the Forgejo host, from /home/ubuntu/forgejo:
sudo docker compose exec runner-docker docker ps
sudo docker compose exec runner-docker docker exec taznado-ci-cd-example \
node -e "fetch('http://127.0.0.1:3000/').then(r => r.text()).then(console.log)"
To stop and remove only the demo deployment:
sudo docker compose exec runner-docker docker rm -f taznado-ci-cd-example
For your own project, change IMAGE_NAME and APP_NAME, adapt the tests and
Dockerfile, and configure an appropriate deployment target. An empty commit or
the Actions tab's manual run starts the example pipeline again.