Containerization and Docker Image Publishing
The CI/CD job called Containerize and Publish Image runs on the latest version of Ubuntu and depends on the previously executed Performance Testing jobs. It is intended to create a Docker image of an application, upload it to the Docker Image repository - DockerHub and create an artifact with the version information of the Docker image.
Description
Checkout repository: uses the actions/checkout@v4 action to download the content of the repository to the working environment. This step ensures that the repository will be available for further steps in the workflow.
Log in to DockerHub: uses the docker/login-action@v3 action to log in to DockerHub. It retrieves login information, such as username and password, from stored secrets.
Build and push docker image: this step executes a script that:
creates a Docker image tag (IMAGE_TAG) using the username and the current "commit SHA" (github.sha),
builds the Docker image with the tag (docker build -t $IMAGE_TAG .),
upload the Docker image to the DockerHub repository (docker push $IMAGE_TAG),
saves the Docker image tag to a file (image-tag.txt) for further use.
Upload IMAGE_TAG file: uses the actions/upload-artifact@v4 action to upload the image-tag.txt file as an artifact. This file contains the Docker image tag and will be used in the following steps.
Output configuration: the job defines the output data (image-tag) to be used in other parts of the pipeline. The content of this output is the Docker image-tag stored in the previous step.