|
| 1 | +name: Docker Multi-arch Build |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + image-name: |
| 7 | + required: true |
| 8 | + type: string |
| 9 | + secrets: |
| 10 | + GITHUB_TOKEN: |
| 11 | + required: true |
| 12 | + |
| 13 | +jobs: |
| 14 | + build-amd64: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + env: |
| 17 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 18 | + |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v4 |
| 21 | + - name: Login to GitHub Container Registry |
| 22 | + uses: docker/login-action@v3 |
| 23 | + with: |
| 24 | + registry: ghcr.io |
| 25 | + username: ${{ github.actor }} |
| 26 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 27 | + - name: install rops |
| 28 | + run: | |
| 29 | + curl -L https://raw.githubusercontent.com/quantmind/rops/main/dev/install-rops | bash |
| 30 | + echo "$HOME/bin" >> $GITHUB_PATH |
| 31 | + - name: build amd64 |
| 32 | + run: rops docker build ${{ inputs.image-name }} |
| 33 | + - name: push amd64 |
| 34 | + run: rops docker push ${{ inputs.image-name }} --arch |
| 35 | + |
| 36 | + build-arm64: |
| 37 | + runs-on: ubuntu-24.04-arm |
| 38 | + env: |
| 39 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 40 | + |
| 41 | + steps: |
| 42 | + - uses: actions/checkout@v4 |
| 43 | + - name: Login to GitHub Container Registry |
| 44 | + uses: docker/login-action@v3 |
| 45 | + with: |
| 46 | + registry: ghcr.io |
| 47 | + username: ${{ github.actor }} |
| 48 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 49 | + - name: install rops |
| 50 | + run: | |
| 51 | + curl -L https://raw.githubusercontent.com/quantmind/rops/main/dev/install-rops | bash |
| 52 | + echo "$HOME/bin" >> $GITHUB_PATH |
| 53 | + - name: build arm64 |
| 54 | + run: rops docker build ${{ inputs.image-name }} |
| 55 | + - name: push arm64 |
| 56 | + run: rops docker push ${{ inputs.image-name }} --arch |
| 57 | + |
| 58 | + manifest: |
| 59 | + needs: [build-amd64, build-arm64] |
| 60 | + runs-on: ubuntu-latest |
| 61 | + env: |
| 62 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 63 | + steps: |
| 64 | + - uses: actions/checkout@v4 |
| 65 | + - name: Login to GitHub Container Registry |
| 66 | + uses: docker/login-action@v3 |
| 67 | + with: |
| 68 | + registry: ghcr.io |
| 69 | + username: ${{ github.actor }} |
| 70 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 71 | + - name: install rops |
| 72 | + run: | |
| 73 | + curl -L https://raw.githubusercontent.com/quantmind/rops/main/dev/install-rops | bash |
| 74 | + echo "$HOME/bin" >> $GITHUB_PATH |
| 75 | + - name: create manifest |
| 76 | + run: rops docker manifest ${{ inputs.image-name }} |
0 commit comments