diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index fb3f7d1..41d1d5c 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -6,51 +6,51 @@ on: - 'main' tags: - 'v**' +env: + REGISTRY: quay.io + IMAGE_NAME: cloudevents-player + JAVA_VERSION: '17' + jobs: build: runs-on: ubuntu-latest + name: "Build native images" steps: - name: Checkout uses: actions/checkout@v3 - name: Set up QEMU uses: docker/setup-qemu-action@v2 - - name: Set up graalVM - uses: graalvm/setup-graalvm@v1 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 with: - version: 'latest' - java-version: '17' - components: 'native-image' - github-token: ${{ secrets.GITHUB_TOKEN }} - - name: Build the project - run: | - ./mvnw package -Pnative + install: true - name: Define tags shell: bash run: | POM_VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout) VERSION=v${POM_VERSION%-SNAPSHOT} - if [ ${{ github.ref }} == 'refs/heads/main' ]; then - echo "docker_tag=latest ${VERSION}" >> $GITHUB_OUTPUT - else - echo "docker_tag=${VERSION}" >> $GITHUB_OUTPUT - fi + echo "docker_tag=${VERSION}" >> $GITHUB_OUTPUT id: build_tags - - name: Build the container image - id: build-image - uses: redhat-actions/buildah-build@v2 + - name: Setup Java + uses: actions/setup-java@v3 with: - image: cloudevents-player - tags: ${{ steps.build_tags.outputs.docker_tag }} - archs: amd64, arm64 - dockerfiles: | - ./src/main/docker/Dockerfile.native-micro - - name: Push to registry - id: push-to-quay - uses: redhat-actions/push-to-registry@v2 + java-version: ${{ env.JAVA_VERSION }} + distribution: temurin + cache: maven + - name: Log in to Quay + uses: docker/login-action@v2 with: - image: ${{ steps.build-image.outputs.image }} - tags: ${{ steps.build-image.outputs.tags }} - registry: quay.io/ruben + registry: ${{ env.REGISTRY }} username: ${{ secrets.QUAY_USER }} password: ${{ secrets.QUAY_PASSWORD }} - \ No newline at end of file + - name: Build the project + run: | + if [ ${{ github.ref }} == 'refs/heads/main' ]; then + additional_tags="-Dquarkus.container-image.additional-tags=latest" + fi + ./mvnw -B clean package -Dcontainer \ + -Dquarkus.docker.buildx.platform=linux/amd64,linux/arm64 \ + -Dquarkus.native.container-build=true \ + -Dquarkus.docker.buildx.output=type=registry \ + -Dquarkus.container-image.tag=${{ steps.build_tags.outputs.docker_tag }} \ + ${additional_tags:-} \ No newline at end of file diff --git a/pom.xml b/pom.xml index 83ec1b6..1495227 100644 --- a/pom.xml +++ b/pom.xml @@ -83,7 +83,7 @@ io.quarkus - quarkus-container-image-jib + quarkus-container-image-docker io.quarkus