99 gcr-dockerhub-build-publish :
1010 runs-on : ubuntu-latest
1111 steps :
12- -
13- name : Checkout
12+ - name : Checkout
1413 uses : actions/checkout@v2
15- -
16- name : Set up QEMU
17- uses : docker/setup-qemu-action@v1
18- -
19- name : Set up Docker Buildx
20- uses : docker/setup-buildx-action@v1
21- -
22- name : Login to DockerHub
14+ - name : Update runc (temporary fix) # TODO: Remove step when https://github.com/actions/virtual-environments/issues/2658 fixed
15+ run : |
16+ sudo apt-get install libseccomp-dev
17+ git clone https://github.com/opencontainers/runc
18+ cd runc
19+ make
20+ sudo make install
21+ - name : Login to Docker Hub
2322 uses : docker/login-action@v1
2423 with :
2524 username : ${{ secrets.DOCKERHUB_USERNAME }}
2625 password : ${{ secrets.DOCKERHUB_TOKEN }}
27- -
28- name : Login to GitHub Container Registry
26+ - name : Login to GitHub Container Registry (GHCR)
2927 uses : docker/login-action@v1
3028 with :
3129 registry : ghcr.io
3230 username : ${{ github.repository_owner }}
3331 password : ${{ secrets.CR_PAT }}
34- -
35- name : Show Runners environment (debug)
32+ - name : Show Runners environment (debug)
3633 shell : bash
3734 run : export
38- -
39- name : Identify GitHub tag name
35+ - name : Identify GitHub tag name
4036 shell : bash
4137 # get tag name from runners environment 'GITHUB_REF' and then use bash substring
4238 # to strip out '+' symbol - required due to gcr not supporting this as a tag
4339 # name (docker hub does support it).
4440 # note if push is NOT triggered by tag then 'GITHUB_REF' will be the branch name.
4541 run : echo "##[set-output name=tag;]$(tag_name=${GITHUB_REF#refs/tags/} && echo "${tag_name//+/-}")"
4642 id : identify_tag
47- -
48- name : Build and Push to GCR and Docker Hub
49- uses : docker/build-push-action@v2
50- with :
51- context : .
52- file : ./Dockerfile
53- platforms : linux/amd64
54- push : true
55- tags : |
56- ${{ github.repository }}:latest
57- ${{ github.repository }}:${{ steps.identify_tag.outputs.tag }}
58- ghcr.io/${{ github.repository }}:latest
59- ghcr.io/${{ github.repository }}:${{ steps.identify_tag.outputs.tag }}
43+ - name : Build Docker image and tag
44+ run : |
45+ docker build \
46+ --tag ${{ github.repository }}:latest \
47+ --tag ${{ github.repository }}:${{ steps.identify_tag.outputs.tag }} \
48+ --tag ghcr.io/${{ github.repository }}:latest \
49+ --tag ghcr.io/${{ github.repository }}:${{ steps.identify_tag.outputs.tag }} \
50+ .
51+ - name : Push Docker image to Docker Hub
52+ run : |
53+ docker push ${{ github.repository }}:latest
54+ docker push ${{ github.repository }}:${{ steps.identify_tag.outputs.tag }}
55+ - name : Push Docker image to GitHub Container Registry (GHCR)
56+ run : |
57+ docker push ghcr.io/${{ github.repository }}:latest
58+ docker push ghcr.io/${{ github.repository }}:${{ steps.identify_tag.outputs.tag }}
0 commit comments