This example was bootstrapped from the Quarkus getting started tutorial. I have added the following 3 files in the root directorywhich are sufficient to run it on kubernetes:
- Dockerfile - this is about the simplest docker file that will build a container to run the app. For more enterprise-ready docker files that were generated by quarkus, see src/main/docker
- deployment.yaml - this is a simple kubernetes deployment file. It will automatically create a ReplicaSet that manages a number of Pods
- service.yaml - this creates a NodePort service that allows the deployment to be accessed from outside the cluster
The v2 branch of this repository has an example state of this repo after an update has been deployed.
Note: in production, it is likely that the deployment.yaml and service.yaml would live in a separate gitops repository.
- Run application using
./mvnw compile quarkus:dev
- Run
curl http://localhost:8080/hello
As if I were a delivery pipeline...
- Run the tests
./mvnw test
- Show the
Dockerfile
- Run
./mvnw package
- Show the jar in the
target
folder - Show the other docker files
- Build it:
docker build -t qhello:1 .
- Run it locally
docker run -p 12345:8080 qhello:1
- List the images
ic cr images --restrict dom-test
- Tag the image
docker tag qhello:1 us.icr.io/dom-test/qhello:1
- (Skipped) Push it
docker push us.icr.io/dom-test/qhello:1
kubectl apply -f deployment.yaml
kubectl apply -f service.yaml
- Edit the code - change the message
- Run
curl http://localhost:8080/hello
again
- Run & fix the tests
./mvnw test
- Package again
./mvnw package
- Build it:
docker build -t qhello:2 .
- Tag it:
docker tag qhello:2 us.icr.io/dom-test/qhello:2
- (Skipped) Push it
docker push us.icr.io/dom-test/qhello:2
- Edit the
deployment.yaml
to ref the new version - Apply the changes
kubectl apply -f deployment.yaml
Original quarkus README.md below...
This project uses Quarkus, the Supersonic Subatomic Java Framework.
If you want to learn more about Quarkus, please visit its website: https://quarkus.io/ .
You can run your application in dev mode that enables live coding using:
./mvnw compile quarkus:dev
The application can be packaged using:
./mvnw package
It produces the getting-started-1.0.0-SNAPSHOT-runner.jar
file in the /target
directory.
Be aware that it’s not an über-jar as the dependencies are copied into the target/lib
directory.
If you want to build an über-jar, execute the following command:
./mvnw package -Dquarkus.package.type=uber-jar
The application is now runnable using java -jar target/getting-started-1.0.0-SNAPSHOT-runner.jar
.
You can create a native executable using:
./mvnw package -Pnative
Or, if you don't have GraalVM installed, you can run the native executable build in a container using:
./mvnw package -Pnative -Dquarkus.native.container-build=true
You can then execute your native executable with: ./target/getting-started-1.0.0-SNAPSHOT-runner
If you want to learn more about building native executables, please consult https://quarkus.io/guides/maven-tooling.html.
A Hello World RESTEasy resource