-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build a container image with GraalVM - profile "deepseek" is enabled …
…by default
- Loading branch information
1 parent
4f8580f
commit 5740464
Showing
4 changed files
with
132 additions
and
28 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
name: Build and deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
concurrency: | ||
group: ${{ github.workflow }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
JAVA_VERSION: 21 | ||
|
||
jobs: | ||
test-app: | ||
runs-on: ubuntu-24.04 | ||
outputs: | ||
imageName: ${{ steps.image.outputs.name }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: actions/setup-java@v4 | ||
with: | ||
distribution: liberica | ||
java-version: ${{ env.JAVA_VERSION }} | ||
cache: maven | ||
- name: Test app | ||
run: ./mvnw -B test | ||
- name: Get image name | ||
id: image | ||
run: | | ||
sudo apt-get install -y libxml2-utils | ||
./mvnw -q -B help:effective-pom -Doutput=pom-effective.xml | ||
CNB_IMAGE=`xmllint --xpath "//*[local-name()='execution']//*[local-name()='image']/*[local-name()='name']/text()" pom-effective.xml | head -1` | ||
echo "name=$CNB_IMAGE" >> "$GITHUB_OUTPUT" | ||
build-image: | ||
needs: | ||
- test-app | ||
strategy: | ||
matrix: | ||
os: | ||
- ubuntu-24.04 | ||
- ubuntu-24.04-arm | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: buildpacks/github-actions/[email protected] | ||
- uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: actions/setup-java@v4 | ||
with: | ||
distribution: liberica | ||
java-version: ${{ env.JAVA_VERSION }} | ||
cache: maven | ||
- name: Log in to the container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build image | ||
run: | | ||
./mvnw -Pnative -DskipTests -B spring-boot:build-image | ||
- name: Deploy image | ||
run: | | ||
CNB_TAG="linux-`dpkg --print-architecture`" | ||
CNB_IMAGE=${{ needs.test-app.outputs.imageName }} | ||
docker tag $CNB_IMAGE:latest $CNB_IMAGE:$CNB_TAG | ||
docker push $CNB_IMAGE:$CNB_TAG | ||
package-image: | ||
needs: | ||
- test-app | ||
- build-image | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- name: Log in to the container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Package multi-arch image | ||
run: | | ||
CNB_IMAGE=${{ needs.test-app.outputs.imageName }} | ||
docker manifest create $CNB_IMAGE:latest --amend $CNB_IMAGE:linux-arm64 --amend $CNB_IMAGE:linux-amd64 | ||
docker manifest push $CNB_IMAGE:latest | ||
trigger-gitops: | ||
needs: | ||
- package-image | ||
runs-on: ubuntu-24.04 | ||
env: | ||
GH_TOKEN: ${{ secrets.GITOPS_TOKEN }} | ||
TARGET_OWNER: alexandreroman | ||
TARGET_REPO: rpilab | ||
TARGET_WORKFLOW: gitops.yaml | ||
steps: | ||
- name: trigger-gitops | ||
run: | | ||
curl -L -X POST -H "Accept: application/vnd.github+json" \ | ||
-H "Authorization: token $GH_TOKEN" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
https://api.github.com/repos/$TARGET_OWNER/$TARGET_REPO/actions/workflows/$TARGET_WORKFLOW/dispatches \ | ||
-d '{"ref":"main"}' |
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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