|
| 1 | +name: Docker Build and Push |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*.*.*' |
| 7 | + |
| 8 | +jobs: |
| 9 | + release: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + outputs: |
| 12 | + version: ${{ github.ref_name }} |
| 13 | + steps: |
| 14 | + - name: Checkout |
| 15 | + uses: actions/checkout@v4 |
| 16 | + with: |
| 17 | + fetch-depth: 0 |
| 18 | + |
| 19 | + docker: |
| 20 | + needs: release |
| 21 | + runs-on: ${{ matrix.arch.runner }} |
| 22 | + strategy: |
| 23 | + matrix: |
| 24 | + arch: |
| 25 | + - runner: ubuntu-24.04 |
| 26 | + platform: amd64 |
| 27 | + - runner: ubuntu-24.04-arm |
| 28 | + platform: arm64 |
| 29 | + image: |
| 30 | + - image-name: ton-http-api-cpp |
| 31 | + context: . |
| 32 | + dockerfile: Dockerfile |
| 33 | + steps: |
| 34 | + - name: Checkout |
| 35 | + uses: actions/checkout@v4 |
| 36 | + with: |
| 37 | + submodules: recursive |
| 38 | + |
| 39 | + # TODO: fix this |
| 40 | + - name: Apply patch to ton-blockchain/ton |
| 41 | + run: | |
| 42 | + cd external/ton |
| 43 | + git apply ../../patches/ton_001.patch |
| 44 | + |
| 45 | + # TODO: fix this |
| 46 | + - name: Apply patch to userver-framework/userver |
| 47 | + run: | |
| 48 | + cd external/ton |
| 49 | + git apply ../../patches/userver_001.patch |
| 50 | +
|
| 51 | + - name: Login to DockerHub |
| 52 | + uses: docker/login-action@v3 |
| 53 | + with: |
| 54 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 55 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 56 | + |
| 57 | + - name: Build and push Docker image |
| 58 | + uses: docker/build-push-action@v5 |
| 59 | + with: |
| 60 | + context: ${{ matrix.image.context }} |
| 61 | + file: ${{ matrix.image.context }}/${{ matrix.image.dockerfile }} |
| 62 | + platforms: linux/${{ matrix.arch.platform }} |
| 63 | + push: true |
| 64 | + tags: | |
| 65 | + ${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.image.image-name }}:${{ needs.release.outputs.version }}-${{ matrix.arch.platform }} |
| 66 | +
|
| 67 | + manifest: |
| 68 | + needs: [docker, release] |
| 69 | + runs-on: ubuntu-24.04 |
| 70 | + strategy: |
| 71 | + matrix: |
| 72 | + image: |
| 73 | + - ton-http-api-cpp |
| 74 | + steps: |
| 75 | + - name: Login to DockerHub |
| 76 | + uses: docker/login-action@v3 |
| 77 | + with: |
| 78 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 79 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 80 | + |
| 81 | + - name: Create and push manifest |
| 82 | + run: | |
| 83 | + docker manifest create ${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.image }}:${{ needs.release.outputs.version }} \ |
| 84 | + --amend ${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.image }}:${{ needs.release.outputs.version }}-amd64 \ |
| 85 | + --amend ${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.image }}:${{ needs.release.outputs.version }}-arm64 |
| 86 | + docker manifest push ${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.image }}:${{ needs.release.outputs.version }} |
0 commit comments