- Created by Michael Zdravkovski.
- LinkedIn: linkedin.com/in/michael-zdravkovski
- Docker Repository: https://hub.docker.com/repository/docker/mz1234/bob-tech-challenge
NodeJS has been used to host a MockServer to send requests to in order to retrieve the latest Git commit hash, App name and also the app version.
The URL which this is hosted on is: localhost:8888/health
To set this up locally, do the following:
- Download git locally
- Clone the repo using git, replace REPO.git with the repository link
- git clone REPO.git
- Download and install Docker
- Download and install npm
Build locally:
- Use docker to build the container. Replace username with your own.
- docker build -t USERNAME/test-app .
- Run the docker container, specifying port 8888. Replace username with your own.
- docker run -d -p 8888:8000 USERNAME/test-app
- Once running, use a curl request to test the solution
- curl localhost:8888/health
Testing the build:
- To run tests, find the container_id
- docker container list -a
- Execute the tests, replace container_id with your own.
- docker exec CONTAINER_ID npm test unit.js
To set this up as a pipeline in Github and deploy to DockerHub:
- Use the YAML template provided in /.github/workflows
- Create a secret called DOCKER_USERNAME
- Use your Docker username
- Create a secret called DOCKER_PASSWORD
- Use your Docker password
- Amend as you see fit
To set this up using the image in DockerHub:
- Pull the docker image from DockerHug
- docker pull mz1234/bob-tech-challenge
- Once running, use a curl request to test the solution
- curl localhost:8888/health