Skip to content

Commit

Permalink
fix(pull-docker-image): do not pull if image is already present
Browse files Browse the repository at this point in the history
  • Loading branch information
EdieLemoine committed Jul 18, 2023
1 parent 31c0b92 commit cc720cc
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion pull-docker-image/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,20 @@ runs:
if: steps.docker-cache.outputs.cache-hit != 'true'
shell: bash
run: |
docker pull ${{ inputs.image }}
# if not present, pull from registry
EXISTS=$(docker image inspect ${{ inputs.image }} > /dev/null 2>&1))
# if image is not present, pull it
if [ $? -ne 0 ]; then
echo "Image not found, pulling from registry"
docker pull ${{ inputs.image }}
else
echo "Image found, skipping pull"
fi
- name: 'Save image to disk'
if: steps.docker-cache.outputs.cache-hit != 'true'
shell: bash
run: |
mkdir -p ${{ inputs.cache-directory }}
docker save -o ${{ inputs.cache-directory }}/image-${{ steps.hash.outputs.filename }}.tar ${{ inputs.image }}

0 comments on commit cc720cc

Please sign in to comment.