fix: use crane to extract cross-platform host-info binaries #116
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: Build and Push Docker Images | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| env: | |
| REGISTRY: registry.v0l.io | |
| HOST_INFO_IMAGE: registry.v0l.io/lnvps-host-info | |
| jobs: | |
| # Build host-info as a multi-arch image first | |
| build-host-info: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to Docker Registry | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: registry | |
| password: ${{ secrets.REGISTRY_TOKEN }} | |
| - name: Build and push lnvps-host-info | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: lnvps_host_util/Dockerfile | |
| platforms: linux/amd64,linux/arm64 | |
| push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} | |
| tags: ${{ env.HOST_INFO_IMAGE }}:latest | |
| # Build main images after host-info is ready | |
| build: | |
| runs-on: ubuntu-latest | |
| needs: build-host-info | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: lnvps-api | |
| file: lnvps_api/Dockerfile | |
| image: registry.v0l.io/lnvps-api:latest | |
| - name: lnvps-api-admin | |
| file: lnvps_api_admin/Dockerfile | |
| image: registry.v0l.io/lnvps-api-admin:latest | |
| - name: lnvps-operator | |
| file: lnvps_operator/Dockerfile | |
| image: registry.v0l.io/lnvps-operator:latest | |
| - name: lnvps-nostr | |
| file: lnvps_nostr/Dockerfile | |
| image: registry.v0l.io/lnvps-nostr:latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to Docker Registry | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: registry | |
| password: ${{ secrets.REGISTRY_TOKEN }} | |
| - name: Build and push ${{ matrix.name }} | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ${{ matrix.file }} | |
| push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} | |
| tags: ${{ matrix.image }} | |
| build-args: | | |
| HOST_INFO_IMAGE=${{ env.HOST_INFO_IMAGE }}:latest |