Example repo Node.js CI/CD with GitHub Actions
The goals are incremental:
-
Build and test Node.js app code after pushes
-
Build Docker image and publish to DockerHub after new tag pushes
-
(TODO) Deploy to servers or clusters
Add secrets to this repository before using GitHub Actions workflows.
The 2 secrets required to push Docker images to Docker Hub is:
-
DOCKERHUB_USERNAME
- your username on Docker Hub -
DOCKERHUB_TOKEN
- your Docker Hub access token
These will be used by workflow docker.yaml to authenticate when pushing to Docker Hub.
The example web app needs to connect to a MongoDB instance.
The repo provides a [Dockerfile] and a docker-compose.yaml
to
help you understand how the app works:
# Interactive run
docker compose -f ./deploy/docker-compose.yaml up;
# Detached run
docker compose -f ./deploy/docker-compose.yaml up -d;
# Stop
docker compose -f ./deploy/docker-compose.yaml down;