This script automates the process of updating Docker base images in a project. It checks the current base image in the Dockerfile against the latest available version, creates a new branch for the update, modifies the necessary files, commits the changes, pushes the branch to the remote repository, and creates a pull request.
This script is intended to be run within a Bitbucket pipeline, but it can also be run locally as long as the required environment variables are set.
The script uses the following command to filter image tags based on a specific pattern. You can modify this regular expression based on your project requirements to filter different tags.
PAGE_TAGS=$(echo "$RESPONSE" | jq -r '.results[].name' | grep -E "^20(\.[0-9]+)*-alpine[0-9.]*$"