Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
167 commits
Select commit Hold shift + click to select a range
1feda16
build(pom): add the Quarkus extensions required by the project
EdgarEldy Sep 19, 2026
ae36dd8
feat(dto): add the ApiResponse success envelope
EdgarEldy Sep 19, 2026
9cddd34
feat(dto): add PageResponse for paginated lists
EdgarEldy Sep 19, 2026
381080b
feat(exception): add ResourceNotFoundException as an HttpProblem
EdgarEldy Sep 19, 2026
38c0046
feat(exception): add BusinessRuleException as an HttpProblem
EdgarEldy Sep 19, 2026
35b2797
feat(health): add a readiness check that opens a real database connec…
EdgarEldy Sep 19, 2026
240d8ac
feat(health): add a liveness check that ignores external dependencies
EdgarEldy Sep 19, 2026
21c0994
feat(flyway): add V1 schema for the identity and e-commerce domains
EdgarEldy Sep 19, 2026
e1305cd
chore(security): add a development-only RSA key pair for JWT signing
EdgarEldy Sep 19, 2026
d1d5bb0
build(config): configure datasource, Flyway and JWT per profile
EdgarEldy Sep 19, 2026
1869fb6
chore(docker): remove the Dockerfiles generated by the project scaffold
EdgarEldy Sep 19, 2026
ca9132d
build(docker): let the build context contain the sources
EdgarEldy Sep 19, 2026
b157bad
build(docker): add a multi-stage Dockerfile for the JVM application
EdgarEldy Sep 19, 2026
254ece7
build(docker): add docker-compose for the packaged application
EdgarEldy Sep 19, 2026
e302a2c
ci(workflow): run mvn verify on every push and pull request
EdgarEldy Sep 19, 2026
d29b5f1
chore(scaffold): remove the sample GreetingResource generated by the …
EdgarEldy Sep 19, 2026
7c4d7b2
test(dto): cover the ApiResponse success factory
EdgarEldy Sep 19, 2026
d6c4223
test(dto): cover the PageResponse page count arithmetic
EdgarEldy Sep 19, 2026
eac64c6
test(health): check readiness and liveness over HTTP
EdgarEldy Sep 19, 2026
f4ad0a1
test(flyway): verify the V1 migration and its constraints
EdgarEldy Sep 19, 2026
267e8be
test(exception): prove errors are RFC 9457 problem documents
EdgarEldy Sep 19, 2026
69b92cd
fix(security): keep the development JWT keys out of the packaged jar
EdgarEldy Sep 19, 2026
8270d7e
fix(health): log why the readiness check reports DOWN
EdgarEldy Sep 19, 2026
fd048d5
style(test): add the standard Javadoc header to the Payload record
EdgarEldy Sep 19, 2026
0d50b91
docs(docker): explain the key file permissions needed by the container
EdgarEldy Sep 19, 2026
42043ec
docs(readme): check off core-architecture and align it with what was …
EdgarEldy Sep 19, 2026
5c93432
fix(config): point the dev and test JWT key locations to dev-keys
EdgarEldy Sep 19, 2026
5b973cd
docs(github): add a pull request template
EdgarEldy Sep 19, 2026
dd994e5
ci(workflow): validate Conventional Commits on pull requests
EdgarEldy Sep 19, 2026
95ee64c
Merge pull request #1 from EdgarEldy/feature/core-architecture
EdgarEldy Sep 19, 2026
fc85c2e
build(pom): add quarkus-elytron-security-common for password hashing
EdgarEldy Sep 19, 2026
cb54455
feat(entity): add the User entity and its repository
EdgarEldy Sep 19, 2026
15f862f
feat(entity): add ActivationToken and its repository
EdgarEldy Sep 19, 2026
7e47c73
feat(entity): add PasswordResetToken and its repository
EdgarEldy Sep 19, 2026
29870b2
feat(entity): add BlacklistedToken and its repository
EdgarEldy Sep 19, 2026
7a5ba8c
feat(dto): add the RegisterRequest record
EdgarEldy Sep 19, 2026
eea2813
feat(dto): add the LoginRequest record
EdgarEldy Sep 19, 2026
d7048e8
feat(dto): add the forgot and reset password request records
EdgarEldy Sep 19, 2026
9b8983b
feat(dto): add the AuthResponse record
EdgarEldy Sep 19, 2026
a11e61c
feat(dto): add the UserResponse record
EdgarEldy Sep 19, 2026
42bf536
feat(exception): add AuthenticationFailedException as an HttpProblem
EdgarEldy Sep 19, 2026
0d09027
feat(security): add JwtIssuer to sign access tokens
EdgarEldy Sep 19, 2026
57fb165
feat(service): add the AuthService contract
EdgarEldy Sep 19, 2026
ff8c985
feat(service): implement AuthService
EdgarEldy Sep 19, 2026
53c1202
feat(security): add a filter rejecting revoked tokens
EdgarEldy Sep 19, 2026
1491c52
feat(config): declare the JWT bearer security scheme for OpenAPI
EdgarEldy Sep 19, 2026
377eeac
feat(resource): add AuthResource with the authentication endpoints
EdgarEldy Sep 19, 2026
a5959b4
test(resource): cover the authentication flow end to end
EdgarEldy Sep 19, 2026
e0977a4
test(resource): prove forgot password does not reveal registered emails
EdgarEldy Sep 19, 2026
44c12b4
test(service): unit test the AuthService rules with Mockito
EdgarEldy Sep 19, 2026
8885c31
test(repository): check the user and token queries against PostgreSQL
EdgarEldy Sep 19, 2026
508c75c
test(security): verify the tokens issued by JwtIssuer
EdgarEldy Sep 19, 2026
169c8d4
fix(service): reject logout for a deleted account and correct a misle…
EdgarEldy Sep 19, 2026
a150c5c
docs(readme): check off feature/auth and correct the BcryptUtil depen…
EdgarEldy Sep 19, 2026
8a6cb77
Merge pull request #2 from EdgarEldy/feature/auth
EdgarEldy Sep 19, 2026
bd01b49
feat(flyway): seed the baseline permissions and the ADMIN role
EdgarEldy Sep 19, 2026
02826ec
feat(entity): add the Permission entity and its repository
EdgarEldy Sep 19, 2026
9a15870
feat(entity): add the Role entity and its repository
EdgarEldy Sep 19, 2026
1641e01
feat(entity): add the AuditLog entity and its repository
EdgarEldy Sep 19, 2026
b7a5ea9
feat(entity): give User the roles it holds
EdgarEldy Sep 19, 2026
bbe06f8
feat(dto): add the RBAC request and response records
EdgarEldy Sep 19, 2026
3f11cbc
feat(security): add AuditLogger for RBAC mutations
EdgarEldy Sep 19, 2026
d4e5876
feat(service): add the RbacService contract
EdgarEldy Sep 19, 2026
1674a2d
feat(service): implement RbacService with the reference and last admi…
EdgarEldy Sep 19, 2026
308152e
feat(security): resolve permissions in a SecurityIdentityAugmentor
EdgarEldy Sep 19, 2026
4ac7c65
feat(resource): add UserResource for role assignment
EdgarEldy Sep 19, 2026
9f7adf8
feat(resource): add RoleResource with permission assignment
EdgarEldy Sep 19, 2026
58b82bd
feat(resource): add PermissionResource
EdgarEldy Sep 19, 2026
cae331c
feat(scheduler): add a daily cleanup of expired tokens
EdgarEldy Sep 19, 2026
e3becec
feat(config): create an optional bootstrap administrator at startup
EdgarEldy Sep 19, 2026
0c923bd
test(rbac): add shared fixtures for the RBAC tests
EdgarEldy Sep 19, 2026
e48f417
test(resource): cover role and permission CRUD
EdgarEldy Sep 19, 2026
b2abfb4
test(resource): cover the administration of users
EdgarEldy Sep 19, 2026
fad7a70
test(resource): check the still referenced rejections
EdgarEldy Sep 19, 2026
cc596f6
test(resource): prove the last administrator can never be removed
EdgarEldy Sep 19, 2026
b3d2dfb
test(resource): assert every RBAC mutation is audited
EdgarEldy Sep 19, 2026
447b84e
test(security): verify the permission augmentor and the annotation ch…
EdgarEldy Sep 19, 2026
69d997d
test(scheduler): check the expired token cleanup
EdgarEldy Sep 19, 2026
a34d71a
fix(repository): count only active accounts as administrators
EdgarEldy Sep 19, 2026
6d5bb59
fix(security): keep success audit rows transactional and serialise la…
EdgarEldy Sep 19, 2026
a02f6d9
docs(readme): check off feature/rbac and document the bootstrap admin…
EdgarEldy Sep 19, 2026
f06a473
test(security): pin down the transaction behaviour of the audit logger
EdgarEldy Sep 19, 2026
5165ede
test(resource): cover inactive holders and concurrent removals in the…
EdgarEldy Sep 19, 2026
d1c1e51
Merge pull request #3 from EdgarEldy/feature/rbac
EdgarEldy Sep 19, 2026
8e7823c
feat(entity): add the Category entity and its repository
EdgarEldy Sep 19, 2026
160be12
feat(dto): add the category request and response records
EdgarEldy Sep 19, 2026
cd6d680
feat(service): add the CategoryService contract
EdgarEldy Sep 19, 2026
a8799ab
feat(service): implement CategoryService with the deletion rule
EdgarEldy Sep 19, 2026
14e274d
feat(resource): add CategoryResource
EdgarEldy Sep 19, 2026
176cb94
test(resource): cover every category endpoint and its access rules
EdgarEldy Sep 19, 2026
8e0a0ec
test(service): unit test the category deletion and lookup rules
EdgarEldy Sep 19, 2026
7014f6b
test(repository): check the product count against PostgreSQL
EdgarEldy Sep 19, 2026
8653d29
docs(readme): check off feature/categories
EdgarEldy Sep 19, 2026
9acd592
Merge pull request #4 from EdgarEldy/feature/categories
EdgarEldy Sep 19, 2026
4296bb4
feat(entity): add the Product entity
EdgarEldy Sep 19, 2026
63c99aa
feat(repository): add ProductRepository with the category filter
EdgarEldy Sep 19, 2026
3f19abf
refactor(repository): drop the native product count from CategoryRepo…
EdgarEldy Sep 19, 2026
2c01925
refactor(service): count a category's products through ProductRepository
EdgarEldy Sep 19, 2026
80fca59
feat(dto): add ProductRequest with Bean Validation
EdgarEldy Sep 19, 2026
02b82ca
feat(dto): add ProductResponse
EdgarEldy Sep 19, 2026
b401bdf
feat(service): add the ProductService contract
EdgarEldy Sep 19, 2026
dc38ddb
build(config): configure the product cache
EdgarEldy Sep 19, 2026
18cd637
feat(service): implement ProductService with a per-product cache
EdgarEldy Sep 19, 2026
e1c5c7f
feat(resource): add ProductResource
EdgarEldy Sep 19, 2026
23befed
test(repository): cover the category filter and count on PostgreSQL
EdgarEldy Sep 19, 2026
9ba235d
test(repository): count products through ProductRepository
EdgarEldy Sep 19, 2026
0e6aec5
test(service): mock ProductRepository in the category deletion tests
EdgarEldy Sep 19, 2026
b2e6267
test(service): unit test product creation, update, deletion and lookup
EdgarEldy Sep 19, 2026
f7d0959
test(service): prove the product cache hits, invalidates and skips er…
EdgarEldy Sep 19, 2026
e27f53b
test(resource): cover every product endpoint and its access rules
EdgarEldy Sep 19, 2026
ff0af23
docs(readme): check off feature/products
EdgarEldy Sep 19, 2026
ba38305
fix(service): scale the product price to two decimals on write
EdgarEldy Sep 19, 2026
09e824c
test(service): check the price scale returned on creation
EdgarEldy Sep 19, 2026
6d73476
Merge pull request #5 from EdgarEldy/feature/products
EdgarEldy Sep 19, 2026
c576e5e
feat(entity): add the Customer entity
EdgarEldy Sep 19, 2026
3dc8988
feat(repository): add CustomerRepository
EdgarEldy Sep 19, 2026
2cd9c45
feat(dto): add CustomerRequest with Bean Validation
EdgarEldy Sep 19, 2026
0de2653
feat(dto): add CustomerResponse
EdgarEldy Sep 19, 2026
7efc8e2
feat(service): add the CustomerService contract
EdgarEldy Sep 19, 2026
e0a3b79
feat(service): implement CustomerService
EdgarEldy Sep 19, 2026
da679ff
feat(resource): add CustomerResource
EdgarEldy Sep 19, 2026
e07999d
test(repository): round trip customers on PostgreSQL
EdgarEldy Sep 19, 2026
e7172a5
test(service): unit test the customer service with mocks
EdgarEldy Sep 19, 2026
3c8eea7
test(resource): cover every customer endpoint and its access rules
EdgarEldy Sep 19, 2026
5c09feb
docs(readme): check off feature/customers
EdgarEldy Sep 19, 2026
577c5fe
Merge pull request #6 from EdgarEldy/feature/customers
EdgarEldy Sep 19, 2026
495f250
feat(entity): add the Order entity under the CustomerOrder name
EdgarEldy Sep 19, 2026
a566f87
feat(repository): add OrderRepository with customer and product filters
EdgarEldy Sep 19, 2026
5fa3bf5
feat(dto): add OrderRequest with Bean Validation
EdgarEldy Sep 19, 2026
6f581f4
feat(dto): add OrderResponse
EdgarEldy Sep 19, 2026
a1b1f9c
feat(service): add the OrderService contract
EdgarEldy Sep 19, 2026
2744574
feat(service): implement OrderService and compute the total
EdgarEldy Sep 19, 2026
47aec91
feat(resource): add OrderResource
EdgarEldy Sep 19, 2026
de08351
feat(service): refuse to delete a product that has orders
EdgarEldy Sep 19, 2026
f3614dc
feat(service): refuse to delete a customer that has orders
EdgarEldy Sep 19, 2026
4f3c501
test(repository): check the CustomerOrder queries against PostgreSQL
EdgarEldy Sep 19, 2026
1381b75
test(service): unit test the order total and its refusals
EdgarEldy Sep 19, 2026
3037d51
test(resource): cover the order endpoints and the deletion rules
EdgarEldy Sep 19, 2026
ca1d05f
test(service): cover the refusal to delete a product with orders
EdgarEldy Sep 19, 2026
767fb50
test(service): cover the refusal to delete a customer with orders
EdgarEldy Sep 19, 2026
9e7cd9c
docs(readme): check off feature/orders
EdgarEldy Sep 19, 2026
d747563
Merge pull request #7 from EdgarEldy/feature/orders
EdgarEldy Sep 19, 2026
849b147
build(docker): let the Maven wrapper into the build context
EdgarEldy Sep 19, 2026
505baf7
build(docker): add the multi-stage Dockerfile.native
EdgarEldy Sep 19, 2026
ad8b01b
build(scripts): add a startup and memory measurement script
EdgarEldy Sep 19, 2026
845b2d0
ci(workflow): add a native build verification job
EdgarEldy Sep 19, 2026
7ee73c7
fix(service): create the token generator at run time for native builds
EdgarEldy Sep 19, 2026
743ac06
fix(scripts): pass the port by environment and time out the startup wait
EdgarEldy Sep 19, 2026
954a3b6
docs(native): record how the native build works and what it measured
EdgarEldy Sep 19, 2026
1ee7c83
docs(readme): check off feature/native-build
EdgarEldy Sep 19, 2026
cb40653
fix(scripts): wait for the app to stop and reject failed load requests
EdgarEldy Sep 19, 2026
4836b6e
Merge pull request #8 from EdgarEldy/feature/native-build
EdgarEldy Sep 19, 2026
e715318
build(deps): add Hibernate Reactive Panache and the reactive PostgreS…
EdgarEldy Sep 19, 2026
0ff06d9
build(config): give the reactive slice its own persistence unit and d…
EdgarEldy Sep 19, 2026
aa88b1e
build(docker): pass the reactive connection URL to the application
EdgarEldy Sep 19, 2026
e40ec3d
feat(entity): add ReactiveOrder for the reactive persistence unit
EdgarEldy Sep 19, 2026
540740d
feat(repository): add the reactive order repository
EdgarEldy Sep 19, 2026
9d102f6
feat(service): add the OrderCreatedEvent
EdgarEldy Sep 19, 2026
c243230
feat(service): broadcast committed orders as a reactive stream
EdgarEldy Sep 19, 2026
3291c6b
feat(service): publish an event when an order is created
EdgarEldy Sep 19, 2026
b1c9052
feat(resource): add the order SSE stream endpoint
EdgarEldy Sep 19, 2026
47a9e04
test(service): give the order service a mocked event in the unit tests
EdgarEldy Sep 19, 2026
f5e96e1
test(service): assert the broadcast with a Mutiny subscriber
EdgarEldy Sep 19, 2026
feb83cc
test(resource): cover the SSE endpoint over HTTP
EdgarEldy Sep 19, 2026
29dea79
docs(readme): check off feature/reactive-endpoints
EdgarEldy Sep 19, 2026
455553e
fix(service): keep the order stream alive when one reload fails
EdgarEldy Sep 19, 2026
6f57114
Merge pull request #9 from EdgarEldy/feature/reactive-endpoints
EdgarEldy Sep 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Keep the build context small and free of local files
*
!target/*-runner
!target/*-runner.jar
!target/lib/*
!target/quarkus-app/*
!pom.xml
!src/
!mvnw
!.mvn/
5 changes: 5 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copy to .env (ignored by git) and adjust. Read by docker-compose.yml only.
DB_NAME=quarkus_tutorial
DB_USER=quarkus
DB_PASSWORD=change-me
APP_PORT=8080
30 changes: 30 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
## Branch

<!-- e.g. feature/core-architecture -->

## Task checklist

<!-- Copy the relevant section's checklist from README.md and check off each item. -->

- [ ]

## Commit summary

<!-- One line per group of commits, summarizing what changed and why. -->

## Test checklist

- [ ] Unit tests pass
- [ ] Integration tests pass (where the branch's checklist calls for them)
- [ ] `mvn verify` is green on the whole project

## Code review checklist

- [ ] No business logic in JAX-RS resources
- [ ] Success responses are wrapped in `ApiResponse<T>`, errors are RFC 9457 Problem Details (`HttpProblem`), never `ApiResponse` on an error path
- [ ] Permission checks are declarative (`@PermissionsAllowed`), no manual permission `if`
- [ ] Every `@CacheResult` has its matching `@CacheInvalidate` on the write operations
- [ ] Every RBAC mutation calls `AuditLogger`
- [ ] The database schema only changes through a Flyway migration
- [ ] No manual Testcontainers setup (Dev Services only)
- [ ] Commits are atomic (one commit per file added or modified), follow Conventional Commits, no em dash, no Claude/Anthropic mention
87 changes: 87 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: CI

on:
push:
branches: [master, develop]
pull_request:
branches: [master, develop]

jobs:
build-and-test:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Java 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "21"
cache: maven

# No "services: postgres" block on purpose. Quarkus Dev Services starts its own PostgreSQL
# container through the Docker daemon already available on ubuntu-latest, exactly as it does
# locally, so the tests need nothing provisioned by the workflow.
- name: Build and test
run: ./mvnw -B verify

# Slower and independent of the test job: it compiles the application to a GraalVM native
# executable, checks that Dockerfile.native builds, and measures JVM mode against native mode.
native-build:
runs-on: ubuntu-latest

# The packaged application (not the tests) needs a real database, so this job does declare a
# PostgreSQL service. Dev Services only exists in dev and test mode.
services:
postgres:
image: postgres:16
env:
POSTGRES_DB: quarkus_tutorial
POSTGRES_USER: quarkus
POSTGRES_PASSWORD: ci-only-password
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U quarkus -d quarkus_tutorial"
--health-interval 5s --health-timeout 3s --health-retries 10

env:
DB_URL: jdbc:postgresql://localhost:5432/quarkus_tutorial
DB_USER: quarkus
DB_PASSWORD: ci-only-password
# The repository's development key pair, fine for a throwaway CI database.
JWT_PUBLIC_KEY_LOCATION: ${{ github.workspace }}/dev-keys/publicKey.pem
JWT_PRIVATE_KEY_LOCATION: ${{ github.workspace }}/dev-keys/privateKey.pem

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Java 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "21"
cache: maven

- name: Package the JVM application
run: ./mvnw -B package -DskipTests

# container-build compiles inside a Mandrel builder container, so no local GraalVM is needed.
- name: Build the native executable
run: ./mvnw -B package -Dnative -Dquarkus.native.container-build=true -DskipTests

- name: Measure JVM mode against native mode
run: |
{
echo "| Mode | Ready after (ms) | Reported startup (s) | RSS after load (MB) |"
echo "|---|---|---|---|"
scripts/measure-startup.sh jvm java -jar target/quarkus-app/quarkus-run.jar
scripts/measure-startup.sh native target/*-runner
} | tee -a "$GITHUB_STEP_SUMMARY"
ls -l target/*-runner

- name: Check that Dockerfile.native builds
run: docker build -f Dockerfile.native -t quarkus-tutorial:native .
43 changes: 43 additions & 0 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: PR checks

on:
pull_request:
branches: [master, develop]

jobs:
commit-lint:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Validate commit messages (Conventional Commits)
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
set -euo pipefail

pattern='^(feat|fix|refactor|test|docs|chore|build|ci|style|perf)\([a-z0-9.,/_-]+\): .{1,100}$'
failed=0

while IFS= read -r subject; do
[ -z "$subject" ] && continue
if [[ "$subject" =~ $pattern ]]; then
echo "OK: $subject"
else
echo "INVALID: $subject"
failed=1
fi
done < <(git log "$BASE_SHA..$HEAD_SHA" --no-merges --pretty=format:'%s')

if [ "$failed" -ne 0 ]; then
echo ""
echo "One or more commit messages do not follow Conventional Commits."
echo "Expected format: <type>(<scope>): <short summary>"
echo "Allowed types: feat, fix, refactor, test, docs, chore, build, ci, style, perf"
exit 1
fi
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,6 @@ logs/
# JVM crash logs
hs_err_pid*
replay_pid*

# Production JWT keys used with docker-compose
keys/
28 changes: 28 additions & 0 deletions Dockerfile.jvm
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Multi-stage image for the packaged JVM application.
# Stage 1 compiles and packages with Maven, stage 2 keeps only a JRE and the Quarkus runnable output.

FROM maven:3.9-eclipse-temurin-21 AS build
WORKDIR /build

# Copying the pom alone first lets Docker cache the dependency download until the pom changes.
COPY pom.xml .
RUN mvn -B -q dependency:go-offline

COPY src ./src
# Tests are skipped here: they rely on Dev Services, which needs a Docker daemon a build stage
# does not have. They run in CI with mvn verify instead.
RUN mvn -B -q package -DskipTests

FROM eclipse-temurin:21-jre
WORKDIR /app

# Run as a non-root user so a compromised process has no rights on the container.
RUN useradd --system --no-create-home quarkus
USER quarkus

# quarkus-app is the fast-jar layout: dependencies sit in separate directories that rarely change,
# so rebuilding after a code change only replaces a small layer.
COPY --from=build --chown=quarkus /build/target/quarkus-app/ ./

EXPOSE 8080
ENTRYPOINT ["java", "-jar", "quarkus-run.jar"]
30 changes: 30 additions & 0 deletions Dockerfile.native
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Multi-stage image for the GraalVM native executable.
# Stage 1 compiles the application to a native binary with Mandrel (Red Hat's GraalVM distribution),
# stage 2 keeps only that binary on a minimal runtime image: no JVM, no Maven, no sources.

FROM quay.io/quarkus/ubi9-quarkus-mandrel-builder-image:jdk-21 AS build
USER root
WORKDIR /build

# The builder image ships Mandrel but not Maven, so the Maven wrapper is used. Copying the wrapper and
# the pom alone first lets Docker cache the dependency download until the pom changes.
COPY mvnw .
COPY .mvn .mvn
COPY pom.xml .
RUN ./mvnw -B -q dependency:go-offline

COPY src ./src
# -Dnative switches on the pom's native profile. Tests are skipped here: they rely on Dev Services,
# which needs a Docker daemon a build stage does not have, and they run in CI with mvn verify.
RUN ./mvnw -B -q package -Dnative -DskipTests

# The runtime image only needs the C libraries the native binary links against.
FROM quay.io/quarkus/ubi9-quarkus-micro-image:2.0
WORKDIR /work

# Same idea as Dockerfile.jvm: never run as root.
COPY --from=build --chown=1001:root --chmod=0755 /build/target/*-runner /work/application

EXPOSE 8080
USER 1001
ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"]
Loading
Loading