Skip to content

Commit

Permalink
Enable build of fondant dev base image (#818)
Browse files Browse the repository at this point in the history
Change dev image build step. Build and tag image with additional `dev`
tag.
  • Loading branch information
mrchtr authored Jan 29, 2024
1 parent d97246d commit 6fd57c1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ jobs:
run: ./scripts/build_components.sh --cache -t $GITHUB_SHA -t dev

- name: Build base image
run: ./scripts/build_base_image.sh -t $GITHUB_SHA
run: ./scripts/build_base_image.sh -t $GITHUB_SHA -t dev
26 changes: 21 additions & 5 deletions scripts/build_base_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,46 @@ set -e
function usage {
echo "Usage: $0 [options]"
echo "Options:"
echo " -t, --tag <value> Set the tag (default: latest)"
echo " -t, --tag <value> Tag to add to image, repeatable"
echo " -h, --help Display this help message"
}

# Parse the arguments
while [[ "$#" -gt 0 ]]; do case $1 in
-t|--tag) tag="$2"; shift;;
-t |--tag) tags+=("$2"); shift;;
-h|--help) usage; exit;;
*) echo "Unknown parameter passed: $1"; exit 1;;
esac; shift; done

# Check for required argument
if [ -z "${tags}" ]; then
echo "Error: tag parameter is required"
usage
exit 1
fi

# Supported Python versions
python_versions=("3.8" "3.9" "3.10" "3.11")


for python_version in "${python_versions[@]}"; do
BASENAME=fondant
IMAGE_TAG=${tag}-py${python_version}

image_tags=()
echo "Tagging image with following tags:"
for tag in "${tags[@]}"; do
image_tags+=("${tag}-py${python_version}")
done

full_image_names=()

# create repo if not exists
aws ecr-public describe-repositories --region us-east-1 --repository-names ${BASENAME} || aws ecr-public create-repository --region us-east-1 --repository-name ${BASENAME}
full_image_names+=("public.ecr.aws/fndnt/${BASENAME}:${IMAGE_TAG}")
full_image_names+=("fndnt/${BASENAME}:${IMAGE_TAG}")

for image_tag in "${image_tags[@]}"; do
full_image_names+=("public.ecr.aws/fndnt/${BASENAME}:${image_tag}")
full_image_names+=("fndnt/${BASENAME}:${image_tag}")
done

# Add argument for each tag
for image_name in "${full_image_names[@]}" ; do
Expand Down

0 comments on commit 6fd57c1

Please sign in to comment.