BUILD Phase
build_image:
stage: build # Define the stage of the CI/CD pipeline as 'build'
image: docker:latest # Use the latest version of the Docker image
script: # The list of commands that are run during this stage
- docker login -u "$DOCKERHUB_USERNAME" -p "$DOCKERHUB_PASSWORD" # Log in to Docker Hub using environment variables for credentials
- VERSION=$(cat version.txt) # Read the version number from version.txt and store it in a variable named VERSION
- docker build -t asafahmad/ghost:$VERSION . # Build the Docker image and tag it using the version number
- docker push asafahmad/ghost:$VERSION # Push the built image with its tag to Docker Hub


Last updated