Skip to content

Commit

Permalink
try pushing to dockerhub
Browse files Browse the repository at this point in the history
  • Loading branch information
Remi-Gau committed Sep 29, 2024
1 parent fad2fdb commit 6a5866b
Showing 1 changed file with 43 additions and 9 deletions.
52 changes: 43 additions & 9 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,6 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# # cache tarred docker image to speed up build on follow up runs
# - uses: actions/cache@v4
# id: cache
# with:
# path: ${{ env.IMAGE }}/image.tar
# key: data
# - if: ${{ steps.cache.outputs.cache-hit != 'true' }}
# name: Load image
# run: docker load -i ${{ env.IMAGE }}/image.tar
- name: Build the Docker image
run: |
docker build . --tag ${{env.USER_NAME}}/${{env.REPO_NAME}}
Expand Down Expand Up @@ -137,3 +128,46 @@ jobs:
with:
name: output_${{ matrix.type }}
path: /home/runner/work/cat12-container/cat12-container/tests/data/ds002799/derivatives

docker-push:
runs-on: ubuntu-latest
needs: [one-session]
defaults:
run:
shell: bash -el {0}
if: ${{ github.ref == 'refs/heads/main' || github.ref_type == 'tag' }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Restore docker image
uses: actions/download-artifact@v4
with:
name: docker
path: ${{ env.IMAGE }}
- name: Log in to Docker Hub
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Load image
run: docker load -i ${{ env.IMAGE }}/image.tar
- name: Push unstable to dockerhub on tags or on main
run: |
echo "Pushing unstable versions to DockerHub"
unstable="${{env.USER_NAME}}/${{env.REPO_NAME}}:unstable"
docker tag "${{env.USER_NAME}}/${{env.REPO_NAME}}" "${unstable}"
docker push "${unstable}"
- name: Push stable release to dockerhub on tags only
if: ${{ github.ref_type == 'tag' }}
run: |
echo "Pushing stable and latest versions to DockerHub for latest and ${{ github.ref_name }}"
unstable="${{env.USER_NAME}}/${{env.REPO_NAME}}:unstable"
latest="${{env.USER_NAME}}/${{env.REPO_NAME}}:latest"
docker tag "${unstable}" "${latest}"
docker push "${latest}"
tagged_release="${{env.USER_NAME}}/${{env.REPO_NAME}}:${{ github.ref_name }}"
docker tag "${unstable}" "${tagged_release}"
docker push "${tagged_release}"

0 comments on commit 6a5866b

Please sign in to comment.