- NodeJS Sample API written in Typescript
- Multistage Dockerfile
- GitHub Actions
- GitLab Pipeline
$ docker build -t multistage:v1 -f Dockerfile .
The Docker file contains commands to install the npm packages, build the TypeScript code to NodeJS and serve the application using PM2 server.
$ docker run -itd -p 3025:3025 multistage:v1
This command will run the container in detached mode. The application will be available on port 3025.
Port mapping:
<HOST_PORT>:<CONTAINER_PORT>
3025:3025
Fork the repository. You can find the actions script in the following location.
.github/workflows/docker-image.yml
Go to Settings -> Secrets and Variables -> Actions -> Repository Secrets to add the DockerHub credentials as secrets. Add DOCKER_USERNAME and DOCKER_PASSWORD.
Then go to actions to see the action.
Clone the repository and push to GitLab or migrate the repository. You can find the pipeline script in the file .gitlab-ci.yml.
Go to Settings -> CICD -> Variables to add the DockerHub credentials as secrets. Add REGISTRY_USER and REGISTRY_PASSWORD.
You can find the pipeline in Build -> Pipelines.