Running our application on Minishift

Start your Minishift environment as usual and execute the following command to build the native executable Docker image of your application and deploy it in a Pod:

$ mvn package -Pnative -Dnative-image.docker-build=true

Building the native image of your application will take a minute or so. Next, we will upload the application as a binary build into a Minishift namespace. You should already be familiar with these steps, so we will just include the script to be executed, along with some inline comments. Execute each line and verify that the output is successful for all the commands:

#Create a new Project named quarkus-customer-service
$ oc new-project quarkus-customer-service

# Binary Build definition
$ oc new-build --binary --name=quarkus-customer-service -l app=quarkus-customer-service

# Add the dockerfilePath location to our Binary Build
$ oc patch bc/quarkus-customer-service -p '{"spec":{"strategy":{"dockerStrategy":{"dockerfilePath":"src/main/docker/Dockerfile.native"}}}}'

# Uploading directory "." as binary input for the build
$ oc start-build quarkus-customer-service --from-dir=. --follow

# Create a new application using as source the Binary Build
$ oc new-app --image-stream=quarkus-customer-service:latest

# Create a Route for external clients
$ oc expose svc/quarkus-customer-service

Now, you should be able to see the Pod where your application is running in the Overview panel, which can be reached through the Route - External Traffic link: http://quarkus-customer-service-quarkus-customer-service.192.168.42.53.nip.io (the actual route address depends on the IP address that's been assigned to your environment):

By clicking on the Route - External Traffic link, you will be able to verify that your application works in a Kubernetes environment, just like your local copy does.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.152.87