Use buildx #255
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: C++ Insights Docker Image CI | |
| on: | |
| push: | |
| branches: [master] | |
| repository_dispatch: | |
| types: [rebuild_trigger] | |
| env: | |
| IMAGE_NAME: andreasfertig/cppinsights-container | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-22.04, ubuntu-22.04-arm] | |
| steps: | |
| - name: Set environment variable | |
| shell: bash | |
| run: | | |
| if [[ "${{ matrix.os }}" == "ubuntu-22.04-arm" ]]; then | |
| echo "ARCH=arm64" >> $GITHUB_ENV | |
| else | |
| echo "ARCH=amd64" >> $GITHUB_ENV | |
| fi | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build the Docker image | |
| run: | | |
| make build ARCH=$ARCH | |
| docker tag cppinsights-container:$ARCH ${{ env.IMAGE_NAME }}:$ARCH | |
| - name: Login to DockerHub Registry | |
| run: echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u andreasfertig --password-stdin | |
| - name: Push Docker image | |
| run: docker push ${{ env.IMAGE_NAME }}:$ARCH | |
| create-manifest: | |
| needs: [build] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to DockerHub Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| username: andreasfertig | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Create and push manifest | |
| shell: bash | |
| run: | | |
| docker buildx imagetools create \ | |
| --tag ${{ env.IMAGE_NAME }}:latest \ | |
| ${{ env.IMAGE_NAME }}:amd64 \ | |
| ${{ env.IMAGE_NAME }}:arm64 \ | |
| --push | |
| - name: Notify listeners | |
| run: | | |
| sleep 5 | |
| curl --insecure -I -X POST https://${{ secrets.UPDATE_URL }} &> /dev/null |