Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Force no cache on docker builds.
Browse files Browse the repository at this point in the history
  • Loading branch information
scottarnette committed Feb 24, 2020
1 parent 5cc9866 commit 82b575c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions .cicd/generate-base-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@ TAG=$(echo $FULL_TAG | cut -d: -f2)
EXISTS=$(curl -s -H "Authorization: Bearer $(curl -sSL "https://auth.docker.io/token?service=registry.docker.io&scope=repository:${ORG_REPO}:pull" | jq --raw-output .token)" "https://registry.hub.docker.com/v2/${ORG_REPO}/manifests/$TAG")
# build, if neccessary
if [[ $EXISTS =~ '404 page not found' || $EXISTS =~ 'manifest unknown' || $FORCE_BASE_IMAGE == true ]]; then # if we cannot pull the image, we build and push it first
docker build -t $FULL_TAG -f $CICD_DIR/platforms/$PLATFORM_TYPE/$IMAGE_TAG.dockerfile .
[[ $FORCE_BASE_IMAGE != true ]] && docker push $FULL_TAG
docker build --no-cache -t $FULL_TAG -f $CICD_DIR/platforms/$PLATFORM_TYPE/$IMAGE_TAG.dockerfile .
if [[ $FORCE_BASE_IMAGE != true ]]; then
docker push $FULL_TAG
else
echo "Base image creation successful. Not pushing...".
exit 0
fi
else
echo "$FULL_TAG already exists."
fi

0 comments on commit 82b575c

Please sign in to comment.