{"id":2089,"date":"2025-12-30T14:17:49","date_gmt":"2025-12-30T13:17:49","guid":{"rendered":"https:\/\/www.loicmathieu.fr\/wordpress\/fr\/?p=2089"},"modified":"2025-12-30T14:24:40","modified_gmt":"2025-12-30T13:24:40","slug":"deploy-a-quarkus-application-in-cloud-run","status":"publish","type":"post","link":"https:\/\/www.loicmathieu.fr\/wordpress\/informatique\/deploy-a-quarkus-application-in-cloud-run\/","title":{"rendered":"Deploy a Quarkus application in Cloud Run"},"content":{"rendered":"<p>Quarkus is a microservice development framework designed for the cloud and containers.<\/p>\n<p>It is designed to have reduced memory usage and the shortest possible startup time.<\/p>\n<p>It is mainly based on standards (Jakarta EE, Eclipse MicroProfile, etc.) and allows the use of mature and widely used Java libraries via its extensions (Hibernate, RESTeasy, Vert.X, Kafka, etc.).<\/p>\n<p>Quarkus was designed for the cloud from the beginning, enabling the development of Cloud Ready applications (as defined by the 12 Factors principle) and Cloud Native applications (using the capabilities of public clouds to build your applications).<\/p>\n<p>Google Cloud Run is a Container As A Service solution that allows you to run interface and backend services, batch jobs, hosted LLMs, and queue processing workloads without having to manage the infrastructure.<\/p>\n<p>Quarkus is therefore a good solution for developing an application to deploy to Cloud Run.<\/p>\n<h2>Create a Quarkus application<\/h2>\n<p>First step, create a Quarkus application:<\/p>\n<pre>\nquarkus create app quarkus-cloud-run\n<\/pre>\n<p>The project will be generated in a <code>quarkus-cloud-run<\/code> directory. Move to the root of this directory and launch the application via <code>quarkus dev<\/code>.<\/p>\n<p>You can test the application via <code>curl localhost:8080\/hello<\/code>.<\/p>\n<p>A Quarkus application can run in a JVM or as a native application. Here, we will choose a native image deployment, which is more suitable for cloud deployments.<\/p>\n<p>To build the application as a native image, you can use the following command:<\/p>\n<pre>\ncp src\/main\/docker\/Dockerfile.native Dockerfile\nquarkus build --native\n<\/pre>\n<h2>Deploy to Google Cloud Run<\/h2>\n<p>By default, <code>gcloud<\/code> will send all files of your application except those defined in your <code>.gitignore<\/code> to package your application. You can add directories or files to ignore in a <code>.gcloudignore<\/code> file, for example, the application directory: <code>src\/<\/code>.<\/p>\n<p>To create a container, we will use the Dockerfile provided by Quakus in <code>src\/main\/docker\/Dockerfile.native<\/code>. Simply copy it to the root directory so that it is used by default:<\/p>\n<pre>\ncp src\/main\/docker\/Dockerfile.native Dockerfile\n<\/pre>\n<p><strong>Warning<\/strong>: this Dockerfile contains a directive that is not compatible with Cloud Build. You must modify the <code>COPY<\/code> directive to remove the <code>--chown<\/code> and <code>--chmod<\/code> options:<\/p>\n<pre>\nCOPY target\/*-runner \/work\/application\n<\/pre>\n<p>Cloud Build can package your application and make it available to Cloud Run in the Google Cloud container registry. You can use the following command, which will use the <code>Dockerfile<\/code> located at the root of your application by default:<\/p>\n<pre>\ngcloud builds submit --tag gcr.io\/PROJECT-ID\/quarkus-cloud-run\n<\/pre>\n<p>Once the build is complete, you can launch your application via Cloud Run using the following command, which will use the container previously created by Cloud Build:<\/p>\n<pre>\ngcloud run deploy --image gcr.io\/PROJECT-ID\/quarkus-cloud-run\n<\/pre>\n<p>Once the application is deployed, <code>gcloud<\/code> will display the <strong>Service URL<\/strong> in its logs, which allows us to access the application.<\/p>\n<p>You can test the application via <code>curl SERVICE_URL\/hello<\/code>.<\/p>\n<h2>Add an Health Check<\/h2>\n<p>Cloud Run supports the use of Health Checks in the form of startup probes, liveness probes, and readiness probes.<\/p>\n<p>Quarkus supports Health Checks via the SmallRye Health extension, which you can add to your application using:<\/p>\n<pre>\nquarkus extension add smallrye-health\n<\/pre>\n<p>You must then rebuild the application:<\/p>\n<pre>\nquarkus build --native\ngcloud builds submit --tag gcr.io\/PROJECT-ID\/quarkus-cloud-run\n<\/pre>\n<p>During deployment, you must specify the application&#8217;s health checks to Cloud Run. Here, I have only specified a startup probe:<\/p>\n<pre>\ngcloud run deploy --image gcr.io\/PROJECT-ID\/quarkus-cloud-run \\\n  --startup-probe httpGet.path=\/q\/health\/started,httpGet.port=8080\n<\/pre>\n<p>Quarkus exposes different endpoints for health checks:<\/p>\n<ul>\n<li>\/q\/health\/started<\/li>\n<li>\/q\/health\/live<\/li>\n<li>\/q\/health\/ready<\/li>\n<\/ul>\n<p>You can use them for the different health checks supported by Cloud Run. More information on Cloud Run health checks and how to declare them can be found <a href=\"https:\/\/docs.cloud.google.com\/run\/docs\/configuring\/healthchecks\">here<\/a>.<\/p>\n<p>If you call the <code>\/q\/health\/started<\/code> endpoint used by Cloud Run as a startup probe, you should get a response like this:<\/p>\n<pre>\n{\n    \"status\": \"UP\",\n    \"checks\": [\n    ]\n}\n<\/pre>\n<p><\/p>","protected":false},"excerpt":{"rendered":"<p>Quarkus is a microservice development framework designed for the cloud and containers. It is designed to have reduced memory usage and the shortest possible startup time. It is mainly based on standards (Jakarta EE, Eclipse MicroProfile, etc.) and allows the use of mature and widely used Java libraries via its extensions (Hibernate, RESTeasy, Vert.X, Kafka, etc.). Quarkus was designed for the cloud from the beginning, enabling the development of Cloud Ready applications (as defined by the 12 Factors principle) and&#8230;<p class=\"read-more\"><a class=\"btn btn-default\" href=\"https:\/\/www.loicmathieu.fr\/wordpress\/informatique\/deploy-a-quarkus-application-in-cloud-run\/\"> Read More<span class=\"screen-reader-text\">  Read More<\/span><\/a><\/p><\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"federated","footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[9],"tags":[233,179,11,167],"class_list":["post-2089","post","type-post","status-publish","format-standard","hentry","category-informatique","tag-cloud-run","tag-gcp","tag-java","tag-quarkus"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":1345,"url":"https:\/\/www.loicmathieu.fr\/wordpress\/informatique\/quarkus-et-les-google-cloud-functions\/","url_meta":{"origin":2089,"position":0},"title":"Quarkus and  the Google Cloud Functions","author":"admin","date":"Tuesday November  2nd, 2021","format":false,"excerpt":"Quarkus is a microservice framework designed for the cloud and the containers. It is designed to have a reduced memory usage and the shortest possible startup time. It is mainly based on standards (Jakarta EE, Eclipse MicroProfile, ...) and allows the use of mature and widespread Java libraries via its\u2026","rel":"","context":"In &quot;informatique&quot;","block_context":{"text":"informatique","link":"https:\/\/www.loicmathieu.fr\/wordpress\/category\/informatique\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1560,"url":"https:\/\/www.loicmathieu.fr\/wordpress\/informatique\/quarkus-tip-tester-une-fonction-google-cloud\/","url_meta":{"origin":2089,"position":1},"title":"Quarkus Tip: Testing a Google Cloud function","author":"admin","date":"Thursday December 29th, 2022","format":false,"excerpt":"I recently contributed a PR to Quarkus that contains a testing framework for Google Cloud functions. Quarkus supports creating Google Cloud functions three different ways: Using the Google Cloud API. Using a Quarkus HTTP extension: RESTEasy, Reactive routes, Servlet, Spring Web. Using Funqy, the cloud provider agnostic Quarkus function API.\u2026","rel":"","context":"In &quot;informatique&quot;","block_context":{"text":"informatique","link":"https:\/\/www.loicmathieu.fr\/wordpress\/category\/informatique\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1440,"url":"https:\/\/www.loicmathieu.fr\/wordpress\/informatique\/google-cloud-functions-2nd-gen\/","url_meta":{"origin":2089,"position":2},"title":"Google Cloud Functions 2nd gen","author":"admin","date":"Tuesday March 29th, 2022","format":false,"excerpt":"Sorry, this entry is only available in Fran\u00e7ais.","rel":"","context":"In &quot;informatique&quot;","block_context":{"text":"informatique","link":"https:\/\/www.loicmathieu.fr\/wordpress\/category\/informatique\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/loicmathieu.fr\/wordpress\/wp-content\/uploads\/cloud-function-gen2-instances.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/loicmathieu.fr\/wordpress\/wp-content\/uploads\/cloud-function-gen2-instances.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/loicmathieu.fr\/wordpress\/wp-content\/uploads\/cloud-function-gen2-instances.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":1960,"url":"https:\/\/www.loicmathieu.fr\/wordpress\/informatique\/creer-un-chatbot-avec-google-gemini-vertex-ai-et-quarkus\/","url_meta":{"origin":2089,"position":3},"title":"Creating a chatbot with Google Gemini Vertex AI and Quarkus","author":"admin","date":"Friday June 27th, 2025","format":false,"excerpt":"I recently created a Quarkus extension that provides access to Google Vertex AI. In this article, I'm going to use this extension to create a chatbot. The first step is to create a Quarkus project containing the REST and Google Cloud Vertex AI extensions. Here are the extensions to add\u2026","rel":"","context":"In &quot;informatique&quot;","block_context":{"text":"informatique","link":"https:\/\/www.loicmathieu.fr\/wordpress\/category\/informatique\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/loicmathieu.fr\/wordpress\/wp-content\/uploads\/Capture-decran-du-2025-06-27-14-22-26-1024x376.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/loicmathieu.fr\/wordpress\/wp-content\/uploads\/Capture-decran-du-2025-06-27-14-22-26-1024x376.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/loicmathieu.fr\/wordpress\/wp-content\/uploads\/Capture-decran-du-2025-06-27-14-22-26-1024x376.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":975,"url":"https:\/\/www.loicmathieu.fr\/wordpress\/informatique\/devfest-nantes-2019-developper-une-api-cloud-ready-avec-quarkus\/","url_meta":{"origin":2089,"position":4},"title":"(Fran\u00e7ais) Devfest Nantes 2019 &#8211; D\u00e9velopper une API Cloud Ready avec Quarkus","author":"admin","date":"Thursday October 31st, 2019","format":false,"excerpt":"Sorry, this entry is only available in Fran\u00e7ais.","rel":"","context":"In &quot;informatique&quot;","block_context":{"text":"informatique","link":"https:\/\/www.loicmathieu.fr\/wordpress\/category\/informatique\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1138,"url":"https:\/\/www.loicmathieu.fr\/wordpress\/informatique\/ma-deuxieme-annee-chez-zenika\/","url_meta":{"origin":2089,"position":5},"title":"(Fran\u00e7ais) Ma deuxi\u00e8me ann\u00e9e chez Zenika","author":"admin","date":"Thursday September  3rd, 2020","format":false,"excerpt":"Sorry, this entry is only available in Fran\u00e7ais.","rel":"","context":"In &quot;informatique&quot;","block_context":{"text":"informatique","link":"https:\/\/www.loicmathieu.fr\/wordpress\/category\/informatique\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.loicmathieu.fr\/wordpress\/wp-json\/wp\/v2\/posts\/2089","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.loicmathieu.fr\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.loicmathieu.fr\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.loicmathieu.fr\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.loicmathieu.fr\/wordpress\/wp-json\/wp\/v2\/comments?post=2089"}],"version-history":[{"count":9,"href":"https:\/\/www.loicmathieu.fr\/wordpress\/wp-json\/wp\/v2\/posts\/2089\/revisions"}],"predecessor-version":[{"id":2103,"href":"https:\/\/www.loicmathieu.fr\/wordpress\/wp-json\/wp\/v2\/posts\/2089\/revisions\/2103"}],"wp:attachment":[{"href":"https:\/\/www.loicmathieu.fr\/wordpress\/wp-json\/wp\/v2\/media?parent=2089"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.loicmathieu.fr\/wordpress\/wp-json\/wp\/v2\/categories?post=2089"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.loicmathieu.fr\/wordpress\/wp-json\/wp\/v2\/tags?post=2089"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}