The container builder image that can be used to build QuarkusIO applications.
The image is baked in with the following tools:
Environment Variable | Use | Default |
---|---|---|
WORK_DIR |
The directory that contains sources to build |
/project |
MVN_CMD_ARGS |
The maven goals that need to run |
mvn package -Pnative |
DESTINATION_NAME |
The fully qualified container image name, where the built image will be pushed e.g. docker.io/myrepo/myapp |
|
MAVEN_MIRROR_URL |
The maven mirror url, typically the repository manager URL to make builders faster |
|
HTTP_PROXY_HOST |
The HTTP proxy host to use with Maven |
|
HTTP_PROXY_PORT |
The HTTP proxy port to use with Maven |
|
HTTP_PROXY_USERNAME |
The HTTP proxy port to use with Maven |
|
HTTP_PROXY_PASSWORD |
The HTTP proxy password to use with Maven |
|
HTTP_PROXY_NONPROXYHOSTS |
The HTTP hosts to which proxy does not apply |
The builder image has a default maven-run.sh
script that runs a maven build to package the QuarkusIO application. .
You can download the sample source code from knative-tutorial-greeter
git clone https://github.com/redhat-developer-demos/knative-tutorial-greeter
Lets call the cloned folder as $PROJECT_HOME
Minikube is single node Kubernetes cluster that can be used for development purposes. You can download and install Minikube to test the builder.
As of now we dont have a standard way to build and deploy Kubernetes applications from sources. For the sake of demoing this builder we will will use Knative Build, the following command will start minikube locally and setup Knative build in it.
cd $PROJECT_HOME/java/quarkus
Before the knative resources are deployed, we need to run the following maven command to configure the build to ones need:
# This will generate the needed knative resources in target/knative directory
mvn -Dcontainer.registry.url='https://index.docker.io' \#(1)
-Dcontainer.registry.user='demo' \#(2)
-Dcontainer.registry.password='password!' \#(3)
-Dgit.source.revision='master' \#(4)
-Dgit.source.repo.url='https://github.com/kameshsampath/knative-tutorial-greeter.git' \#(5)
-Dapp.container.image='docker.io/demo/quarkus-greeter' \#(6)
-Dapp.context.dir='java/quarkus' \#(7)
clean package
-
The docker hub registry url
-
The docker hub user name
-
The docker hub user password
-
The Git source revision
-
The Git source repository url, this repo already has a quarkus app
-
The application container image name, maps to
DESTINATION_NAME
in Environment Variables -
The context directory within the sources that will be built
# apply the resources
kubectl apply -f target/k8s #(1)
-
This will create the following kubernetes resources:
-
A Kubernetes Service Account called
build-bot
that holds container registry push secrets and get events from Knative Builds -
build-watcher role and role binding
-
A maven pvc that can cache maven artifacts after first build, for subsequent faster builds
-
A Deployment and a Service that uses the built image
-
Note
|
Watch the status of the application using and use CTRL + C when you want to terminate the watch. kubectl get pods -w |
Once the build is successfully completed you should see the deployment quarkus-greeter
coming up in few mins, once you see the quarkus-greeter application running you can call it via curl -v $(minikube service quarkus-greeter --url)