Updated: readme instructions #13
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: Multi-Architecture Docker Build | |
| on: | |
| push: | |
| branches: | |
| - '**' | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| build-push-amd64: | |
| runs-on: ubuntu-latest | |
| name: Build AMD64 Image | |
| steps: | |
| - name: Check out the repository | |
| uses: actions/checkout@v3 | |
| with: | |
| submodules: recursive | |
| - name: Extract repository name and branch | |
| id: repo-info | |
| run: | | |
| REPO_NAME=$(echo "${{ github.repository }}" | awk -F '/' '{print $2}' | tr '[:upper:]' '[:lower:]') | |
| REPO_OWNER=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]') | |
| BRANCH_NAME=$(echo "${{ github.ref_name }}" | tr '/' '-' | tr '[:upper:]' '[:lower:]') | |
| echo "REPO_NAME=$REPO_NAME" >> $GITHUB_ENV | |
| echo "REPO_OWNER=$REPO_OWNER" >> $GITHUB_ENV | |
| echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV | |
| - name: Set up Docker Context for Buildx | |
| id: buildx-context | |
| run: | | |
| docker context create builders | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| with: | |
| version: latest | |
| endpoint: builders | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v2 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push AMD64 Docker image | |
| uses: docker/build-push-action@v3 | |
| with: | |
| context: . | |
| file: ./docker/Dockerfile | |
| platforms: linux/amd64 | |
| push: true | |
| provenance: false | |
| tags: | | |
| ghcr.io/${{ env.REPO_OWNER }}/${{ env.REPO_NAME }}:latest-amd64 | |
| ghcr.io/${{ env.REPO_OWNER }}/${{ env.REPO_NAME }}:${{ github.sha }}-amd64 | |
| ghcr.io/${{ env.REPO_OWNER }}/${{ env.REPO_NAME }}:${{ env.BRANCH_NAME }}-amd64 | |
| build-push-arm64: | |
| runs-on: ubuntu-24.04-arm | |
| name: Build ARM64 Image | |
| steps: | |
| - name: Check out the repository | |
| uses: actions/checkout@v3 | |
| with: | |
| submodules: recursive | |
| - name: Extract repository name and branch | |
| id: repo-info | |
| run: | | |
| REPO_NAME=$(echo "${{ github.repository }}" | awk -F '/' '{print $2}' | tr '[:upper:]' '[:lower:]') | |
| REPO_OWNER=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]') | |
| BRANCH_NAME=$(echo "${{ github.ref_name }}" | tr '/' '-' | tr '[:upper:]' '[:lower:]') | |
| echo "REPO_NAME=$REPO_NAME" >> $GITHUB_ENV | |
| echo "REPO_OWNER=$REPO_OWNER" >> $GITHUB_ENV | |
| echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV | |
| - name: Set up Docker Context for Buildx | |
| id: buildx-context | |
| run: | | |
| docker context create builders | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| with: | |
| version: latest | |
| endpoint: builders | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v2 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push ARM64 Docker image | |
| uses: docker/build-push-action@v3 | |
| with: | |
| context: . | |
| file: ./docker/Dockerfile | |
| platforms: linux/arm64 | |
| push: true | |
| provenance: false | |
| tags: | | |
| ghcr.io/${{ env.REPO_OWNER }}/${{ env.REPO_NAME }}:latest-arm64 | |
| ghcr.io/${{ env.REPO_OWNER }}/${{ env.REPO_NAME }}:${{ github.sha }}-arm64 | |
| ghcr.io/${{ env.REPO_OWNER }}/${{ env.REPO_NAME }}:${{ env.BRANCH_NAME }}-arm64 | |
| create-manifests: | |
| runs-on: ubuntu-latest | |
| needs: [build-push-amd64, build-push-arm64] | |
| name: Create Multi-Arch Manifest | |
| steps: | |
| - name: Check out the repository | |
| uses: actions/checkout@v3 | |
| - name: Extract repository name and branch | |
| run: | | |
| REPO_NAME=$(echo "${{ github.repository }}" | awk -F '/' '{print $2}' | tr '[:upper:]' '[:lower:]') | |
| REPO_OWNER=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]') | |
| BRANCH_NAME=$(echo "${{ github.ref_name }}" | tr '/' '-' | tr '[:upper:]' '[:lower:]') | |
| echo "REPO_NAME=$REPO_NAME" >> $GITHUB_ENV | |
| echo "REPO_OWNER=$REPO_OWNER" >> $GITHUB_ENV | |
| echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV | |
| - name: Enable Docker experimental features | |
| run: | | |
| mkdir -p $HOME/.docker | |
| echo '{"experimental": "enabled"}' > $HOME/.docker/config.json | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v2 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create SHA manifest and push | |
| run: | | |
| # Using buildx imagetools instead of docker manifest | |
| docker buildx imagetools create \ | |
| -t ghcr.io/${{ env.REPO_OWNER }}/${{ env.REPO_NAME }}:${{ github.sha }} \ | |
| ghcr.io/${{ env.REPO_OWNER }}/${{ env.REPO_NAME }}:${{ github.sha }}-amd64 \ | |
| ghcr.io/${{ env.REPO_OWNER }}/${{ env.REPO_NAME }}:${{ github.sha }}-arm64 | |
| - name: Create branch manifest and push | |
| run: | | |
| # Using buildx imagetools instead of docker manifest | |
| docker buildx imagetools create \ | |
| -t ghcr.io/${{ env.REPO_OWNER }}/${{ env.REPO_NAME }}:${{ env.BRANCH_NAME }} \ | |
| ghcr.io/${{ env.REPO_OWNER }}/${{ env.REPO_NAME }}:${{ env.BRANCH_NAME }}-amd64 \ | |
| ghcr.io/${{ env.REPO_OWNER }}/${{ env.REPO_NAME }}:${{ env.BRANCH_NAME }}-arm64 | |
| - name: Create latest manifest and push | |
| if: github.ref == 'refs/heads/main' | |
| run: | | |
| # Using buildx imagetools instead of docker manifest | |
| docker buildx imagetools create \ | |
| -t ghcr.io/${{ env.REPO_OWNER }}/${{ env.REPO_NAME }}:latest \ | |
| ghcr.io/${{ env.REPO_OWNER }}/${{ env.REPO_NAME }}:latest-amd64 \ | |
| ghcr.io/${{ env.REPO_OWNER }}/${{ env.REPO_NAME }}:latest-arm64 |