week 4 of Applaudo Studios Program
Develop a docker container of a web server and publish it into a public registry, providing both CI / CD for the image and the repository.
Note you can run the necessary commands to run the container by using the script.sh file:
./script.sh
- Create a docker container of a web server
- Publish the image into a public registry
- Provide CI / CD for the image and the repository
- Create a file and name it Dockerfile in your local directory
- Build the image with the following command:
docker build -t website .
- Run the image with the following command:
docker run -d --name website -p 5000:4000 waltergsteven/website
The name of the container is website and the port is 5000
- Check the container is running with the following command:
docker ps
-
Open your browser and go to http://localhost:5000 the website will look like this:
-
Push the image to Docker Hub with the following command:
docker push waltergsteven/website
- Pull the image from Docker Hub with the following command:
docker pull waltergsteven/website:latest
You can also find the image in the Docker Hub
- Run the image with the following command:
docker run -d --name website -p 5000:4000 waltergsteven/website
The name of the container is website and the port is 5000 use http://localhost:5000 to see the website in your browser
The CI/CD is done using GitHub Actions, the workflow is the following:
- When a pull request from the release branch to the develop branch is created, the branch workflow is triggered.
- The branch workflow will delete the release branch once the pull request is merged.
- When a push is made to the develop branch, the pr workflow is triggered.
- The pr workflow will create a pull request from the develop branch to the release branch.
- Once the pull request is merged, the docker-image workflow is triggered.
- The docker-image workflow will build the image and push it to Docker Hub.