Exercises to practice CI/CD with github actions, testing, containers and some basic concept around devops
First of all, fork this repository, after that clone into your local machine.
git clone https://github.com/your-user-name/devops-bootcamp.git
You'll find a java application that exponse a REST API which divides two numbers passed as parameters. Also, you'll find an example of a github action file in here, take a look before starting.
Anyway, you can use your microservice or microfronted instead of the java application.
- Docker
- Dockerhub account
- Git
- Code simple unit test for the service
- Create a docker image for this service
- Create a pipeline with github action which includes:
- Checkout the code from the repository
- Run unit tests
- Run vulnerabililty scan of your code with trivy
- Build the docker image
- Push docker image to your docker registry
- Download the docker image from your docker registry and run into your local machine
- Do a request to your microservice
- Do a change in the code and push it to your repository
- Download from dockerhub the new image and test your new change
- Do a change in tests to force failing and push to your repository
- You've to create a dockerhub account, then you've to create two secrets in your github repository. See this example
- Remember to create in dockerhub the repository where you're going to upload your image, the name should be the same you've in your github action.
- Your github repository should be public in order to activate Github Code Scanning
- Remember to expose port 8080 when running your docker container
- Good luck!