1212 matrix :
1313 base :
1414 - {image: 'r-ver', amdtag: '4.2.2', armtag: '4.2.2', outname: 'r-ver'}
15- - {image: 'rstudio', amdtag: '4.2.2', armtag: 'latest-daily', outname: 'bioconductor '}
15+ - {image: 'rstudio', amdtag: '4.2.2', armtag: 'latest-daily', outname: 'bioconductor_docker '}
1616 - {image: 'tidyverse', amdtag: '4.2.2', armtag: 'N/A', outname: 'tidyverse'}
1717 - {image: 'ml-verse', amdtag: '4.2.2', armtag: 'N/A', outname: 'ml-verse'}
1818 name : Build branch images
@@ -35,20 +35,35 @@ jobs:
3535 username : ${{ github.actor }}
3636 password : ${{ secrets.GITHUB_TOKEN }}
3737
38+ - name : Login to Dockerhub
39+ uses : docker/login-action@v2
40+ with :
41+ username : ${{ secrets.DOCKER_USERNAME }}
42+ password : ${{ secrets.DOCKER_PASSWORD }}
43+
3844 - name : Extract metadata for container image
3945 id : meta
4046 uses : docker/metadata-action@v4
4147 with :
42- images : ghcr.io/ ${{ github.repository_owner }}/${{ matrix.base.outname }}
48+ images : ${{ github.repository_owner }}/${{ matrix.base.outname }}
4349 tags : |
4450 type=raw,value={{branch}}
4551
52+ - name : Set comma-separated list with all repository names
53+ id : images
54+ run : |
55+ IMG=${{ steps.meta.outputs.tags }}
56+ REPOLIST="docker.io/$IMG,ghcr.io/$IMG"
57+ SUB="_docker"
58+ # Also add alternative without _docker when in name
59+ echo list=$(if [[ $REPOLIST == *$SUB* ]]; then echo "$REPOLIST,$(echo $REPOLIST | sed 's/_docker//g')"; else echo $REPOLIST; fi) >> $GITHUB_OUTPUT
60+
4661 - name : Set up Docker Buildx
4762 uses : docker/setup-buildx-action@v2
4863 with :
4964 platforms : linux/amd64,linux/arm64
5065
51- - name : Build and push container image to GHCR
66+ - name : Build and push container image to all repos both arm64 and amd64
5267 uses : docker/build-push-action@v3
5368 with :
5469 build-args : |
@@ -57,20 +72,20 @@ jobs:
5772 amd64_tag=${{ matrix.base.amdtag }}
5873 file : Dockerfile
5974 push : true
60- tags : ${{ steps.meta .outputs.tags }}
75+ tags : ${{ steps.images .outputs.list }}
6176 labels : ${{ steps.meta.outputs.labels }}
6277 platforms : linux/amd64,linux/arm64
6378 if : matrix.base.armtag != 'N/A'
6479
65- - name : Build and push container image to GHCR
80+ - name : Build and push container image to all repos amd64 only
6681 uses : docker/build-push-action@v3
6782 with :
6883 build-args : |
6984 BASE_IMAGE=rocker/${{ matrix.base.image }}
7085 amd64_tag=${{ matrix.base.amdtag }}
7186 file : Dockerfile
7287 push : true
73- tags : ${{ steps.meta .outputs.tags }}
88+ tags : ${{ steps.images .outputs.list }}
7489 labels : ${{ steps.meta.outputs.labels }}
7590 platforms : linux/amd64
7691 if : matrix.base.armtag == 'N/A'
0 commit comments