Skip to content

Commit

Permalink
✨ Enable native builds for amd64 and aarch64 (#327)
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Montleon <[email protected]>
  • Loading branch information
jmontleon authored Apr 10, 2023
1 parent 81891b0 commit 7b2dd26
Show file tree
Hide file tree
Showing 6 changed files with 131 additions and 141 deletions.
5 changes: 0 additions & 5 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +0,0 @@
*
!target/*-runner
!target/*-runner.jar
!target/lib/*
!target/quarkus-app/*
72 changes: 72 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Tackle Pathfinder CI main

on:
push:
branches: [ main ]

jobs:
unit-test:

runs-on: ubuntu-latest

steps:
- uses: actions/[email protected]
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
java-package: jdk
- name: Cache Maven packages
uses: actions/[email protected]
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build with Maven
run: ./mvnw -U -B test

integration-native-test:

runs-on: ubuntu-latest

steps:
- uses: actions/[email protected]
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
java-package: jdk
- name: Cache Maven packages
uses: actions/[email protected]
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build with Maven
run: ./mvnw -U -B verify -Pnative -Dquarkus-profile=test -Dquarkus.native.additional-build-args=--allow-incomplete-classpath

code-coverage:
runs-on: ubuntu-latest

steps:
- uses: actions/[email protected]
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
java-package: jdk
- name: Cache Maven packages
uses: actions/[email protected]
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Generate jacoco report
run: ./mvnw -U verify -Pjacoco
- uses: codecov/[email protected]
with:
file: ./target/site/jacoco/jacoco.xml
name: codecov
35 changes: 35 additions & 0 deletions .github/workflows/march-image-build-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: 'Build and Push Multi-Arch Image'

on:
workflow_dispatch:
push:
branches:
- 'main'
- 'release-*'
tags:
- 'v*'

concurrency:
group: march-build-${{ github.ref }}
cancel-in-progress: true

jobs:
push-quay:
name: Build and Push Manifest
runs-on: ubuntu-20.04
strategy:
fail-fast: false
steps:
- name: Build Pathfinder Container
uses: konveyor/release-tools/build-push-quay@main
with:
architectures: "amd64, arm64"
containerfile: "./src/main/docker/Dockerfile.native-multi-stage"
image_name: "tackle-pathfinder"
image_namespace: "konveyor"
image_registry: "quay.io"
extra-args: |
--ulimit nofile=65535:65535
quay_publish_robot: ${{ secrets.QUAY_PUBLISH_ROBOT }}
quay_publish_token: ${{ secrets.QUAY_PUBLISH_TOKEN }}
ref: ${{ github.ref }}
136 changes: 0 additions & 136 deletions .github/workflows/push.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
release.properties
tkltest*

# Eclipse
.project
Expand Down
23 changes: 23 additions & 0 deletions src/main/docker/Dockerfile.native-multi-stage
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM registry.access.redhat.com/ubi9/ubi-minimal:latest as builder
COPY . /tackle-pathfinder
RUN microdnf -y install freetype-devel gcc glibc-devel libstdc++-static tar wget which zlib-devel
WORKDIR /opt
RUN wget https://github.com/graalvm/mandrel/releases/download/mandrel-21.3.5.1-Final/mandrel-java11-linux-$(if [ $(uname -m) == "x86_64" ]; then echo amd64; elif [ $(uname -m) == "amd64" ]; then echo amd64; else echo aarch64; fi)-21.3.5.1-Final.tar.gz
RUN tar -xf mandrel-java11-linux-$(if [ $(uname -m) == "x86_64" ]; then echo amd64; elif [ $(uname -m) == "amd64" ]; then echo amd64; else echo aarch64; fi)-21.3.5.1-Final.tar.gz
ENV JAVA_HOME="/opt/mandrel-java11-21.3.5.1-Final"
ENV GRAALVM_HOME="/opt/mandrel-java11-21.3.5.1-Final"
ENV PATH=/opt/mandrel-java11-21.3.5.1-Final/bin:/root/.local/bin:/root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
WORKDIR /tackle-pathfinder
RUN ./mvnw package -Dquarkus.native.container-build=false -Dquarkus.native.container-runtime= -Dmaven.test.skip=true -DskipTests -Pnative

FROM registry.access.redhat.com/ubi9/ubi-minimal:latest
WORKDIR /work/
RUN chown 1001 /work \
&& chmod "g+rwX" /work \
&& chown 1001:root /work
COPY --chown=1001:root --from=builder /tackle-pathfinder/target/*-runner /work/application

EXPOSE 8080
USER 1001

CMD ["./application", "-Dquarkus.http.host=0.0.0.0"]

0 comments on commit 7b2dd26

Please sign in to comment.