Skip to content

Commit

Permalink
fix(pull-docker-image): create unique filename for each image
Browse files Browse the repository at this point in the history
  • Loading branch information
EdieLemoine committed Jan 20, 2023
1 parent f3a7a5f commit f086cb5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pull-docker-image/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,22 @@ runs:
path: ${{ inputs.cache-directory }}
key: docker-cache-${{ runner.os }}

- name: 'Generate image name'
id: hash
shell: bash
run: |
echo "filename=$(echo ${{ inputs.image }} | md5sum | cut -d ' ' -f 1)" >> $GITHUB_OUTPUT
- name: 'Load cached Docker image'
if: steps.docker-cache.outputs.cache-hit == 'true'
shell: bash
run: |
docker load -i ${{ inputs.cache-directory }}/image.tar
docker load -i ${{ inputs.cache-directory }}/image-${{ steps.hash.outputs.filename }}.tar
- name: 'Pull Docker image'
if: steps.docker-cache.outputs.cache-hit != 'true'
shell: bash
run: |
docker pull ${{ inputs.image }}
mkdir -p ${{ inputs.cache-directory }}
docker save -o ${{ inputs.cache-directory }}/image.tar ${{ inputs.image }} }}
docker save -o ${{ inputs.cache-directory }}/image-${{ steps.hash.outputs.filename }}.tar ${{ inputs.image }}

0 comments on commit f086cb5

Please sign in to comment.