This repository builds an Nginx image that serves index.html. When a tag is pushed, the docker-image-build-pipeline.yaml pipeline is triggered. It builds the Docker image, tags it, runs tests to check the container status, performs a curl request to check if the Nginx website is accessible, and finally pushes the versioned image to GitHub Container Registry.
Using Minikube you'll set up a cluster with nginx-deployment.yaml and nginx-svc.yaml. To update the cluster with a newer version you can run the deploy-playbook.yaml.
Before running the application, ensure you have the following installed:
- Minikube
- Ansible
- Docker
Start a Minikube cluster if it is not already running:
minikube startRun the following commands to apply the deployment and service:
kubectl apply -f nginx-deployment.yaml
kubectl apply -f nginx-svc.yamlCheck if the pods are running:
kubectl get podsCheck if the service is up:
kubectl get svcAccess website with the following command:
minikube service frontend-serviceTo update the website and roll out the changes to the cluster:
- Make a change to the index.html file.
- Commit and push the changes.
- Tag the commit with a version number (the tag must start with v, e.g., v1.0.0).
- Push the tag to trigger the pipeline.
Once the pipeline completes, the newly built image will be available here: https://github.com/Enkas1/devops3_examinering/pkgs/container/devops3_examinering
To deploy the newly pushed version, run the following command, replacing "v2.0.0" with your version:
ansible-playbook deploy-playbook.yaml -e new_version="v2.0.0"minikube service frontend-serviceminikube dashboard