diff --git a/.github/workflows/build-n-push-main.yml b/.github/workflows/build-n-push-main.yml index 59f0820..4b05e7d 100644 --- a/.github/workflows/build-n-push-main.yml +++ b/.github/workflows/build-n-push-main.yml @@ -29,82 +29,7 @@ jobs: with: token: ${{ secrets.GIT_PAT }} fetch-depth: 0 - - # - # Cache JDK. - # - - name: Cache JDK - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 - id: cache-jdk - with: - key: OpenJDK21U-jdk_x64_linux_hotspot_21.0.2_13.tar.gz - path: | - ${{ runner.temp }}/jdk_setup.tar.gz - ${{ runner.temp }}/jdk_setup.sha256 - # - # Download JDK and verify its hash. - # - - name: Download JDK and verify its hash - run: | - echo "454bebb2c9fe48d981341461ffb6bf1017c7b7c6e15c6b0c29b959194ba3aaa5 ${{ runner.temp }}/jdk_setup.tar.gz" >> ${{ runner.temp }}/jdk_setup.sha256 - curl -L "https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.2%2B13/OpenJDK21U-jdk_x64_linux_hotspot_21.0.2_13.tar.gz" -o "${{ runner.temp }}/jdk_setup.tar.gz" - sha256sum --check --status "${{ runner.temp }}/jdk_setup.sha256" - - # - # Setup JDK. - # - - name: Setup JDK - uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 - with: - distribution: "jdkfile" - jdkFile: "${{ runner.temp }}/jdk_setup.tar.gz" - java-version: "21" - cache: maven - - # - # Cache Maven. - # - - name: Cache Maven - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 - id: cache-maven - with: - key: apache-maven-3.9.6-bin.tar.gz - path: | - ${{ runner.temp }}/maven_setup.tar.gz - ${{ runner.temp }}/maven_setup.sha256 - - # - # Download Maven and verify its hash. - # - - name: Download Maven and verify its hash - run: | - echo "6eedd2cae3626d6ad3a5c9ee324bd265853d64297f07f033430755bd0e0c3a4b ${{ runner.temp }}/maven_setup.tar.gz" >> ${{ runner.temp }}/maven_setup.sha256 - curl -L "https://archive.apache.org/dist/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.tar.gz" -o "${{ runner.temp }}/maven_setup.tar.gz" - sha256sum --check --status "${{ runner.temp }}/maven_setup.sha256" - - # - # Setup Maven. - # - - name: Setup Maven - run: | - mkdir ${{ runner.temp }}/maven - tar -xvf ${{ runner.temp }}/maven_setup.tar.gz -C ${{ runner.temp }}/maven --strip-components=1 - echo "github${{ secrets.GIT_USER }}${{ secrets.GIT_PAT }}" >> ${{ runner.temp }}/settings.xml - - # - # RELEASE CANDIDATE - Update of pom.xml with the new version. - # - - name: RELEASE CANDIDATE - Update of pom.xml with the new version - run: ${{ runner.temp }}/maven/bin/mvn versions:set -DnewVersion=$BRANCH_NAME -s ${{ runner.temp }}/settings.xml --no-transfer-progress - - - # - # RELEASE CANDIDATE - Build native executable. - # - - name: RELEASE CANDIDATE - Build native executable - run: ${{ runner.temp }}/maven/bin/mvn clean package -Pnative -Dmaven.test.skip=true -Dquarkus.native.container-build=true -Dquarkus.native.builder-image=quay.io/quarkus/ubi-quarkus-mandrel-builder-image@sha256:ce70e1a8016471ff0fc9c8f048cd9e37afddacd3de37ed0bca74201d102e45f5 -s ${{ runner.temp }}/settings.xml --no-transfer-progress - - name: Set up QEMU uses: docker/setup-qemu-action@v3 @@ -113,15 +38,15 @@ jobs: with: driver-opts: network=host - - name: Build and push + - name: Build and pushx uses: docker/build-push-action@v6 with: push: true - file: src/main/docker/Dockerfile.native-micro + file: src/main/docker/Dockerfile.multistage tags: ghcr.io/${{ github.repository }}:${{ github.head_ref || github.ref_name }} - - - + secrets: | + "GIT_USERNAME=${{ secrets.GIT_USER }}" + "GIT_PASSWORD=${{ secrets.GIT_PAT }}" # # Install Node. # diff --git a/src/main/docker/Dockerfile.multistage b/src/main/docker/Dockerfile.multistage index 09b474b..3c8c016 100644 --- a/src/main/docker/Dockerfile.multistage +++ b/src/main/docker/Dockerfile.multistage @@ -5,6 +5,13 @@ COPY --chown=quarkus:quarkus .mvn/ /code/.mvn COPY --chown=quarkus:quarkus pom.xml /code/ USER quarkus WORKDIR /code +RUN --mount=type=secret,id=GIT_USERNAME \ + --mount=type=secret,id=GIT_PASSWORD \ + export GIT_USERNAME=$(cat /run/secrets/GIT_USERNAME) && \ + export GIT_PASSWORD=$(cat /run/secrets/GIT_PASSWORD) && \ + yarn gen + +RUN echo "github$env:GIT_USERNAME$env:GIT_PASSWORD" >> /root/.m2/settings.xml RUN ./mvnw -B org.apache.maven.plugins:maven-dependency-plugin:3.7.1:go-offline COPY src /code/src RUN ./mvnw package -Dnative