Creating docker images with native builds #19
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 | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| release: | |
| types: [ released ] | |
| jobs: | |
| build: | |
| name: Build [JVM] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: corretto | |
| cache: maven | |
| - name: Build | |
| run: make build | |
| - name: Upload artifact [target] | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: target | |
| path: target | |
| retention-days: 7 | |
| docker-jvm: | |
| name: Docker [JVM] | |
| runs-on: ubuntu-latest | |
| needs: | |
| - build | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Download artifact [target] | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: target | |
| path: target | |
| - name: Build and push [jvm-edge] | |
| run: docker buildx build --push -t ghcr.io/javabin/submittheforce:jvm-edge -f src/main/docker/Dockerfile.jvm --platform linux/amd64,linux/arm64 . | |
| - name: Build and push [edge] | |
| run: docker buildx build --push -t ghcr.io/javabin/submittheforce:edge -f src/main/docker/Dockerfile.jvm --platform linux/amd64,linux/arm64 . | |
| - name: Build and push [jvm-latest] | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: docker buildx build --push -t ghcr.io/javabin/submittheforce:jvm-latest -f src/main/docker/Dockerfile.jvm --platform linux/amd64,linux/arm64 . | |
| - name: Build and push [latest] | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: docker buildx build --push -t ghcr.io/javabin/submittheforce:latest -f src/main/docker/Dockerfile.jvm --platform linux/amd64,linux/arm64 . | |
| uber-jar: | |
| name: Uber-JAR | |
| runs-on: ubuntu-latest | |
| needs: | |
| - build | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: corretto | |
| cache: maven | |
| - name: Build uber-JAR | |
| run: make build build-uber | |
| - name: Upload artifact [uber-jar] | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: uber-jar | |
| path: target/submit-runner.jar | |
| retention-days: 7 | |
| - name: Upload asset | |
| uses: k15g/action-github-asset-upload@edge | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| file: target/submit-runner.jar | |
| name: submit-runner.jar | |
| type: application/java-archive | |
| label: Uber-JAR | |
| native-amd64: | |
| name: Native [amd64] | |
| runs-on: ubuntu-latest | |
| needs: | |
| - build | |
| steps: | |
| - name: Checkout | |
| 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: Download artifact [target] | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: target | |
| path: target | |
| - name: Build native | |
| run: make native | |
| - name: Rename file | |
| run: mv target/submit-runner target/submit-runner-linux-x86_64 | |
| - name: Upload artifact [native-amd64] | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: native-amd64 | |
| path: target/submit-runner-linux-amd64 | |
| retention-days: 7 | |
| - name: Upload asset | |
| uses: k15g/action-github-asset-upload@edge | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| file: target/submit-runner-linux-x86_64 | |
| name: submit-runner-linux-amd64 | |
| label: Native [amd64] | |
| native-arm64: | |
| name: Native [arm64] | |
| runs-on: ubuntu-24.04-arm | |
| needs: | |
| - build | |
| steps: | |
| - name: Checkout | |
| 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: Download artifact [target] | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: target | |
| path: target | |
| - name: Build native | |
| run: make native | |
| - name: Rename file | |
| run: mv target/submit-runner target/submit-runner-linux-aarch64 | |
| - name: Upload artifact [native-arm64] | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: native-arm64 | |
| path: target/submit-runner-linux-aarch64 | |
| retention-days: 7 | |
| - name: Upload asset | |
| uses: k15g/action-github-asset-upload@edge | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| file: target/submit-runner-linux-aarch64 | |
| name: submit-runner-linux-aarch64 | |
| label: Native [arm64] | |
| docker-native: | |
| name: Docker [Native] | |
| runs-on: ubuntu-latest | |
| needs: | |
| - native-amd64 | |
| - native-arm64 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Download artifact [native-amd64] | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: native-arm64 | |
| path: target | |
| - name: Download artifact [native-amd64] | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: native-amd64 | |
| path: target | |
| - name: Build and push [native-edge] | |
| run: docker buildx build --push -t ghcr.io/javabin/submittheforce:native-edge -f src/main/docker/Dockerfile.jvm --platform linux/amd64,linux/arm64 . | |
| - name: Build and push [native-latest] | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: docker buildx build --push -t ghcr.io/javabin/submittheforce:native-latest -f src/main/docker/Dockerfile.jvm --platform linux/amd64,linux/arm64 . |