-
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.
- Loading branch information
0 parents
commit 8b6c8e0
Showing
17 changed files
with
674 additions
and
0 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,5 @@ | ||
* | ||
!build/*-runner | ||
!build/*-runner.jar | ||
!build/lib/* | ||
!build/quarkus-app/* |
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,93 @@ | ||
name: Gradle Build | ||
on: [ push ] | ||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
jobs: | ||
release: | ||
name: Docker Release | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
platform: | ||
- linux/amd64 | ||
- linux/arm64 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.IMAGE_NAME }} | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: 17 | ||
distribution: 'adopt' | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build and push by digest | ||
id: build | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
platforms: ${{ matrix.platform }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
outputs: type=image,name=${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true | ||
- name: Export digest | ||
run: | | ||
mkdir -p /tmp/digests | ||
digest="${{ steps.build.outputs.digest }}" | ||
touch "/tmp/digests/${digest#sha256:}" | ||
- name: Upload digest | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: digests | ||
path: /tmp/digests/* | ||
if-no-files-found: error | ||
retention-days: 1 | ||
merge: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- release | ||
steps: | ||
- name: Download digests | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: digests | ||
path: /tmp/digests | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.IMAGE_NAME }} | ||
tags: | | ||
type=raw,value=latest,enable=true | ||
type=semver,pattern={{version}},value=${{ needs.build.outputs.shortversion }} | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Create manifest list and push | ||
working-directory: /tmp/digests | ||
run: | | ||
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ | ||
$(printf '${{ env.IMAGE_NAME }}@sha256:%s ' *) | ||
- name: Inspect image | ||
run: | | ||
docker buildx imagetools inspect ${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }} |
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,39 @@ | ||
# Gradle | ||
.gradle/ | ||
build/ | ||
|
||
# Eclipse | ||
.project | ||
.classpath | ||
.settings/ | ||
bin/ | ||
|
||
# IntelliJ | ||
.idea | ||
*.ipr | ||
*.iml | ||
*.iws | ||
|
||
# NetBeans | ||
nb-configuration.xml | ||
|
||
# Visual Studio Code | ||
.vscode | ||
.factorypath | ||
|
||
# OSX | ||
.DS_Store | ||
|
||
# Vim | ||
*.swp | ||
*.swo | ||
|
||
# patch | ||
*.orig | ||
*.rej | ||
|
||
# Local environment | ||
.env | ||
|
||
# Plugin directory | ||
/.quarkus/cli/plugins/ |
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,21 @@ | ||
## Stage 1 : build with maven builder image with native capabilities | ||
FROM quay.io/quarkus/ubi-quarkus-mandrel-builder-image:jdk-21 AS build | ||
USER root | ||
RUN microdnf install findutils | ||
COPY --chown=quarkus:quarkus gradlew /code/gradlew | ||
COPY --chown=quarkus:quarkus gradle /code/gradle | ||
COPY --chown=quarkus:quarkus build.gradle /code/ | ||
COPY --chown=quarkus:quarkus settings.gradle /code/ | ||
COPY --chown=quarkus:quarkus gradle.properties /code/ | ||
USER quarkus | ||
WORKDIR /code | ||
COPY src /code/src | ||
RUN ./gradlew build -Dquarkus.package.type=native | ||
|
||
## Stage 2 : create the docker final image | ||
FROM quay.io/quarkus/quarkus-micro-image:2.0 | ||
WORKDIR /work/ | ||
COPY --from=build /code/build/*-runner /work/application | ||
RUN chmod 775 /work | ||
EXPOSE 8080 | ||
CMD ["./application", "-Xmx50m"] |
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,56 @@ | ||
# code-with-quarkus | ||
|
||
This project uses Quarkus, the Supersonic Subatomic Java Framework. | ||
|
||
If you want to learn more about Quarkus, please visit its website: https://quarkus.io/ . | ||
|
||
## Running the application in dev mode | ||
|
||
You can run your application in dev mode that enables live coding using: | ||
```shell script | ||
./gradlew quarkusDev | ||
``` | ||
|
||
> **_NOTE:_** Quarkus now ships with a Dev UI, which is available in dev mode only at http://localhost:8080/q/dev/. | ||
## Packaging and running the application | ||
|
||
The application can be packaged using: | ||
```shell script | ||
./gradlew build | ||
``` | ||
It produces the `quarkus-run.jar` file in the `build/quarkus-app/` directory. | ||
Be aware that it’s not an _über-jar_ as the dependencies are copied into the `build/quarkus-app/lib/` directory. | ||
|
||
The application is now runnable using `java -jar build/quarkus-app/quarkus-run.jar`. | ||
|
||
If you want to build an _über-jar_, execute the following command: | ||
```shell script | ||
./gradlew build -Dquarkus.package.type=uber-jar | ||
``` | ||
|
||
The application, packaged as an _über-jar_, is now runnable using `java -jar build/*-runner.jar`. | ||
|
||
## Creating a native executable | ||
|
||
You can create a native executable using: | ||
```shell script | ||
./gradlew build -Dquarkus.package.type=native | ||
``` | ||
|
||
Or, if you don't have GraalVM installed, you can run the native executable build in a container using: | ||
```shell script | ||
./gradlew build -Dquarkus.package.type=native -Dquarkus.native.container-build=true | ||
``` | ||
|
||
You can then execute your native executable with: `./build/code-with-quarkus-1.0.0-SNAPSHOT-runner` | ||
|
||
If you want to learn more about building native executables, please consult https://quarkus.io/guides/gradle-tooling. | ||
|
||
## Provided Code | ||
|
||
### RESTEasy Reactive | ||
|
||
Easily start your Reactive RESTful Web Services | ||
|
||
[Related guide section...](https://quarkus.io/guides/getting-started-reactive#reactive-jax-rs-resources) |
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,41 @@ | ||
plugins { | ||
id 'java' | ||
id 'io.quarkus' | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation 'com.google.code.gson:gson:2.10.1' | ||
implementation 'io.prometheus:simpleclient:0.16.0' | ||
implementation 'io.micrometer:micrometer-registry-prometheus:1.11.5' | ||
|
||
implementation enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}") | ||
implementation 'io.quarkus:quarkus-arc' | ||
implementation 'io.quarkus:quarkus-resteasy-reactive' | ||
implementation 'io.quarkus:quarkus-config-yaml' | ||
implementation 'org.jboss.logmanager:log4j2-jboss-logmanager' | ||
testImplementation 'io.quarkus:quarkus-junit5' | ||
testImplementation 'io.rest-assured:rest-assured' | ||
} | ||
|
||
group 'org.acme' | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_17 | ||
targetCompatibility = JavaVersion.VERSION_17 | ||
} | ||
|
||
test { | ||
systemProperty "java.util.logging.manager", "org.jboss.logmanager.LogManager" | ||
} | ||
compileJava { | ||
options.encoding = 'UTF-8' | ||
options.compilerArgs << '-parameters' | ||
} | ||
|
||
compileTestJava { | ||
options.encoding = 'UTF-8' | ||
} |
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,6 @@ | ||
#Gradle properties | ||
quarkusPluginId=io.quarkus | ||
quarkusPluginVersion=3.5.0 | ||
quarkusPlatformGroupId=io.quarkus.platform | ||
quarkusPlatformArtifactId=quarkus-bom | ||
quarkusPlatformVersion=3.5.0 |
Binary file not shown.
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,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.