8000 java-docs-samples/run at master · deepcodersinc/java-docs-samples · GitHub
[go: up one dir, main page]

Skip to content
{"payload":{"allShortcutsEnabled":false,"path":"run","repo":{"id":266563163,"defaultBranch":"master","name":"java-docs-samples","ownerLogin":"deepcodersinc","currentUserCanPush":false,"isFork":true,"isEmpty":false,"createdAt":"2020-05-24T14:54:40.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/10924207?v=4","public":true,"private":false,"isOrgOwned":false},"currentUser":null,"refInfo":{"name":"master","listCacheKey":"v0:1633510049.234899","canEdit":false,"refType":"branch","currentOid":"0870bb87302faf041ec1f252b530ebc07c31d8af"},"tree":{"items":[{"name":"authentication","path":"run/authentication","contentType":"directory"},{"name":"hello-broken","path":"run/hello-broken","contentType":"directory"},{"name":"helloworld","path":"run/helloworld","contentType":"directory"},{"name":"image-processing","path":"run/image-processing","contentType":"directory"},{"name":"logging-manual","path":"run/logging-manual","contentType":"directory"},{"name":"markdown-preview","path":"run/markdown-preview","contentType":"directory"},{"name":"pubsub","path":"run/pubsub","contentType":"directory"},{"name":"system-package","path":"run/system-package","contentType":"directory"},{"name":"README.md","path":"run/README.md","contentType":"file"}],"templateDirectorySuggestionUrl":null,"readme":{"displayName":"README.md","richText":"\u003carticle class=\"markdown-body entry-content container-lg\" itemprop=\"text\"\u003e\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch1 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eGoogle Cloud Run Java Samples\u003c/h1\u003e\u003ca id=\"user-content-google-cloud-run-java-samples\" class=\"anchor\" aria-label=\"Permalink: Google Cloud Run Java Samples\" href=\"#google-cloud-run-java-samples\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003ca href=\"https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/java-docs-samples\u0026amp;page=editor\u0026amp;open_in_editor=blog/README.md\" rel=\"nofollow\"\u003e\u003cimg src=\"https://camo.githubusercontent.com/cf29981159f3fb8f7d5c5ce0a4a4ab3d2a8e500b782d2016717c3e4aa6124bc5/687474703a2f2f677374617469632e636f6d2f636c6f75647373682f696d616765732f6f70656e2d62746e2e706e67\" alt=\"Open in Cloud Shell\" data-canonical-src=\"http://gstatic.com/cloudssh/images/open-btn.png\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eThis directory contains samples for \u003ca href=\"https://cloud.run\" rel=\"nofollow\"\u003eGoogle Cloud Run\u003c/a\u003e. \u003ca href=\"https://cloud.google.com/run/docs/\" rel=\"nofollow\"\u003eCloud Run\u003c/a\u003e runs stateless \u003ca href=\"https://cloud.google.com/containers/\" rel=\"nofollow\"\u003econtainers\u003c/a\u003e on a fully managed environment or in your own GKE cluster.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eSamples\u003c/h2\u003e\u003ca id=\"user-content-samples\" class=\"anchor\" aria-label=\"Permalink: Samples\" href=\"#samples\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eSample\u003c/th\u003e\n\u003cth\u003eDescription\u003c/th\u003e\n\u003cth\u003eDeploy\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"/deepcodersinc/java-docs-samples/blob/master/run/helloworld\"\u003eHello World\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eQuickstart\u003c/td\u003e\n\u003ctd\u003e\u003ca href=\"https://deploy.cloud.run/?git_repo=https://github.com/GoogleCloudPlatform/java-docs-samples\u0026amp;dir=run/helloworld\" rel=\"nofollow\"\u003e\u003cimg src=\"https://camo.githubusercontent.com/7cb664cef0ae8420268518e77b1e908f877bdff78becee0e0b5c1e71fced0f49/68747470733a2f2f73746f726167652e676f6f676c65617069732e636f6d2f636c6f756472756e2f627574746f6e2e737667\" alt=\"Run on Google Cloud\" height=\"30\" data-canonical-src=\"https://storage.googleapis.com/cloudrun/button.svg\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"/deepcodersinc/java-docs-samples/blob/master/run/pubsub\"\u003eCloud Pub/Sub\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eHandling Pub/Sub push messages\u003c/td\u003e\n\u003ctd\u003e\u003ca href=\"https://deploy.cloud.run/?git_repo=https://github.com/GoogleCloudPlatform/java-docs-samples\u0026amp;dir=run/pubsub\" rel=\"nofollow\"\u003e\u003cimg src=\"https://camo.githubusercontent.com/7cb664cef0ae8420268518e77b1e908f877bdff78becee0e0b5c1e71fced0f49/68747470733a2f2f73746f726167652e676f6f676c65617069732e636f6d2f636c6f756472756e2f627574746f6e2e737667\" alt=\"Run on Google Cloud\" height=\"30\" data-canonical-src=\"https://storage.googleapis.com/cloudrun/button.svg\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"/deepcodersinc/java-docs-samples/blob/master/run/system-package\"\u003eSystem Packages\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eUsing system packages with containers\u003c/td\u003e\n\u003ctd\u003e\u003ca href=\"https://deploy.cloud.run/?git_repo=https://github.com/GoogleCloudPlatform/java-docs-samples\u0026amp;dir=run/system-package\" rel=\"nofollow\"\u003e\u003cimg src=\"https://camo.githubusercontent.com/7cb664cef0ae8420268518e77b1e908f877bdff78becee0e0b5c1e71fced0f49/68747470733a2f2f73746f726167652e676f6f676c65617069732e636f6d2f636c6f756472756e2f627574746f6e2e737667\" alt=\"Run on Google Cloud\" height=\"30\" data-canonical-src=\"https://storage.googleapis.com/cloudrun/button.svg\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"/deepcodersinc/java-docs-samples/blob/master/run/image-processing\"\u003eImage Magick\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eEvent-driven image analysis \u0026amp; transformation\u003c/td\u003e\n\u003ctd\u003e\u003ca href=\"https://deploy.cloud.run/?git_repo=https://github.com/GoogleCloudPlatform/java-docs-samples\u0026amp;dir=run/image-processing\" rel=\"nofollow\"\u003e\u003cimg src=\"https://camo.githubusercontent.com/7cb664cef0ae8420268518e77b1e908f877bdff78becee0e0b5c1e71fced0f49/68747470733a2f2f73746f726167652e676f6f676c65617069732e636f6d2f636c6f756472756e2f627574746f6e2e737667\" alt=\"Run on Google Cloud\" height=\"30\" data-canonical-src=\"https://storage.googleapis.com/cloudrun/button.svg\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"/deepcodersinc/java-docs-samples/blob/master/run/logging-manual\"\u003eManual Logging\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eStructured logging for Stackdriver\u003c/td\u003e\n\u003ctd\u003e\u003ca href=\"https://deploy.cloud.run/?git_repo=https://github.com/GoogleCloudPlatform/java-docs-samples\u0026amp;dir=run/logging-manual\" rel=\"nofollow\"\u003e\u003cimg src=\"https://camo.githubusercontent.com/7cb664cef0ae8420268518e77b1e908f877bdff78becee0e0b5c1e71fced0f49/68747470733a2f2f73746f726167652e676f6f676c65617069732e636f6d2f636c6f756472756e2f627574746f6e2e737667\" alt=\"Run on Google Cloud\" height=\"30\" data-canonical-src=\"https://storage.googleapis.com/cloudrun/button.svg\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"/deepcodersinc/java-docs-samples/blob/master/run/hello-broken\"\u003eLocal Troubleshooting\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eBroken services for local troubleshooting tutorial\u003c/td\u003e\n\u003ctd\u003e\u003ca href=\"https://deploy.cloud.run/?git_repo=https://github.com/GoogleCloudPlatform/java-docs-samples\u0026amp;dir=run/hello-broken\" rel=\"nofollow\"\u003e\u003cimg src=\"https://camo.githubusercontent.com/7cb664cef0ae8420268518e77b1e908f877bdff78becee0e0b5c1e71fced0f49/68747470733a2f2f73746f726167652e676f6f676c65617069732e636f6d2f636c6f756472756e2f627574746f6e2e737667\" alt=\"Run on Google Cloud\" height=\"30\" data-canonical-src=\"https://storage.googleapis.com/cloudrun/button.svg\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"/deepcodersinc/java-docs-samples/blob/master/cloud-sql/mysql/servlet\"\u003eCloud SQL (MySQL)\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eUse MySQL with Cloud Run\u003c/td\u003e\n\u003ctd\u003e\u003ca href=\"https://deploy.cloud.run/?git_repo=https://github.com/GoogleCloudPlatform/java-docs-samples\u0026amp;dir=cloud-sql/mysql/servlet\" rel=\"nofollow\"\u003e\u003cimg src=\"https://camo.githubusercontent.com/7cb664cef0ae8420268518e77b1e908f877bdff78becee0e0b5c1e71fced0f49/68747470733a2f2f73746f726167652e676f6f676c65617069732e636f6d2f636c6f756472756e2f627574746f6e2e737667\" alt=\"Run on Google Cloud\" height=\"30\" data-canonical-src=\"https://storage.googleapis.com/cloudrun/button.svg\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cp dir=\"auto\"\u003eFor more Cloud Run samples beyond Java, see the main list in the \u003ca href=\"https://github.com/GoogleCloudPlatform/cloud-run-samples\"\u003eCloud Run Samples repository\u003c/a\u003e.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eJib\u003c/h2\u003e\u003ca id=\"user-content-jib\" class=\"anchor\" aria-label=\"Permalink: Jib\" href=\"#jib\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThese samples use \u003ca href=\"https://github.com/GoogleContainerTools/jib\"\u003eJib\u003c/a\u003e to\nbuild Docker images using common Java tools. Jib optimizes container builds\nwithout the need for a Dockerfile or having \u003ca href=\"https://www.docker.com/\" rel=\"nofollow\"\u003eDocker\u003c/a\u003e\ninstalled. Learn more about \u003ca href=\"https://github.com/GoogleContainerTools/jib\"\u003ehow Jib works\u003c/a\u003e.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eSetup\u003c/h2\u003e\u003ca id=\"user-content-setup\" class=\"anchor\" aria-label=\"Permalink: Setup\" href=\"#setup\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003col dir=\"auto\"\u003e\n\u003cli\u003e\n\u003cp dir=\"auto\"\u003e\u003ca href=\"https://cloud.google.com/run/docs/setup\" rel=\"nofollow\"\u003eSet up for Cloud Run development\u003c/a\u003e\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp dir=\"auto\"\u003eClone this repository:\u003c/p\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"git clone https://github.com/GoogleCloudPlatform/java-docs-samples.git\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003egit clone https://github.com/GoogleCloudPlatform/java-docs-samples.git\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp dir=\"auto\"\u003eIn the samples's \u003ccode\u003epom.xml\u003c/code\u003e, update the image field for the \u003ccode\u003ejib-maven-plugin\u003c/code\u003e\nwith your Google Cloud Project Id:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-text-xml notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"\u0026lt;plugin\u0026gt;\n \u0026lt;groupId\u0026gt;com.google.cloud.tools\u0026lt;/groupId\u0026gt;\n \u0026lt;artifactId\u0026gt;jib-maven-plugin\u0026lt;/artifactId\u0026gt;\n \u0026lt;version\u0026gt;2.0.0\u0026lt;/version\u0026gt;\n \u0026lt;configuration\u0026gt;\n \u0026lt;to\u0026gt;\n \u0026lt;image\u0026gt;gcr.io/PROJECT_ID/SAMPLE_NAME\u0026lt;/image\u0026gt;\n \u0026lt;/to\u0026gt;\n \u0026lt;/configuration\u0026gt;\n\u0026lt;/plugin\u0026gt;\"\u003e\u003cpre\u003e\u0026lt;\u003cspan class=\"pl-ent\"\u003eplugin\u003c/span\u003e\u0026gt;\n \u0026lt;\u003cspan class=\"pl-ent\"\u003egroupId\u003c/span\u003e\u0026gt;com.google.cloud.tools\u0026lt;/\u003cspan class=\"pl-ent\"\u003egroupId\u003c/span\u003e\u0026gt;\n \u0026lt;\u003cspan class=\"pl-ent\"\u003eartifactId\u003c/span\u003e\u0026gt;jib-maven-plugin\u0026lt;/\u003cspan class=\"pl-ent\"\u003eartifactId\u003c/span\u003e\u0026gt;\n \u0026lt;\u003cspan class=\"pl-ent\"\u003eversion\u003c/span\u003e\u0026gt;2.0.0\u0026lt;/\u003cspan class=\"pl-ent\"\u003eversion\u003c/span\u003e\u0026gt;\n \u0026lt;\u003cspan class=\"pl-ent\"\u003econfiguration\u003c/span\u003e\u0026gt;\n \u0026lt;\u003cspan class=\"pl-ent\"\u003eto\u003c/span\u003e\u0026gt;\n \u0026lt;\u003cspan class=\"pl-ent\"\u003eimage\u003c/span\u003e\u0026gt;gcr.io/PROJECT_ID/SAMPLE_NAME\u0026lt;/\u003cspan class=\"pl-ent\"\u003eimage\u003c/span\u003e\u0026gt;\n \u0026lt;/\u003cspan class=\"pl-ent\"\u003eto\u003c/span\u003e\u0026gt;\n \u0026lt;/\u003cspan class=\"pl-ent\"\u003econfiguration\u003c/span\u003e\u0026gt;\n\u0026lt;/\u003cspan class=\"pl-ent\"\u003eplugin\u003c/span\u003e\u0026gt;\u003c/pre\u003e\u003c/div\u003e\n\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eHow to run a sample locally\u003c/h2\u003e\u003ca id=\"user-content-how-to-run-a-sample-locally\" class=\"anchor\" aria-label=\"Permalink: How to run a sample locally\" href=\"#how-to-run-a-sample-locally\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003col dir=\"auto\"\u003e\n\u003cli\u003e\n\u003cp dir=\"auto\"\u003e\u003ca href=\"https://github.com/GoogleContainerTools/jib\"\u003eBuild the sample container using Jib\u003c/a\u003e:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"mvn compile jib:dockerBuild\"\u003e\u003cpre\u003emvn compile jib:dockerBuild\u003c/pre\u003e\u003c/div\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp dir=\"auto\"\u003e\u003ca href=\"https://cloud.google.com/run/docs/testing/local\" rel=\"nofollow\"\u003eRun containers locally\u003c/a\u003e by\nreplacing \u003ccode\u003ePROJECT_ID\u003c/code\u003e and \u003ccode\u003eSAMPLE_NAME\u003c/code\u003e with your values.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eWith the built container:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"PORT=8080 \u0026amp;\u0026amp; docker run --rm -p 9090:${PORT} -e PORT=${PORT} gcr.io/PROJECT_ID/SAMPLE_NAME\"\u003e\u003cpre\u003ePORT=8080 \u003cspan class=\"pl-k\"\u003e\u0026amp;\u0026amp;\u003c/span\u003e docker run --rm -p 9090:\u003cspan class=\"pl-smi\"\u003e${PORT}\u003c/span\u003e -e PORT=\u003cspan class=\"pl-smi\"\u003e${PORT}\u003c/span\u003e gcr.io/PROJECT_ID/SAMPLE_NAME\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eInjecting your service account key for access to GCP services:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"PORT=8080 \u0026amp;\u0026amp; docker run \\\n -p 9090:${PORT} \\\n -e PORT=${PORT} \\\n -e K_SERVICE=dev \\\n -e K_CONFIGURATION=dev \\\n -e K_REVISION=dev-00001 \\\n -e GOOGLE_APPLICATION_CREDENTIALS=/tmp/keys/[FILE_NAME].json \\\n -v $GOOGLE_APPLICATION_CREDENTIALS:/tmp/keys/[FILE_NAME].json:ro \\\n gcr.io/PROJECT_ID/SAMPLE_NAME\"\u003e\u003cpre\u003ePORT=8080 \u003cspan class=\"pl-k\"\u003e\u0026amp;\u0026amp;\u003c/span\u003e docker run \\\n -p 9090:\u003cspan class=\"pl-smi\"\u003e${PORT}\u003c/span\u003e \\\n -e PORT=\u003cspan class=\"pl-smi\"\u003e${PORT}\u003c/span\u003e \\\n -e K_SERVICE=dev \\\n -e K_CONFIGURATION=dev \\\n -e K_REVISION=dev-00001 \\\n -e GOOGLE_APPLICATION_CREDENTIALS=/tmp/keys/[FILE_NAME].json \\\n -v \u003cspan class=\"pl-smi\"\u003e$GOOGLE_APPLICATION_CREDENTIALS\u003c/span\u003e:/tmp/keys/[FILE_NAME].json:ro \\\n gcr.io/PROJECT_ID/SAMPLE_NAME\u003c/pre\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\n\u003cp dir=\"auto\"\u003eUse the --volume (-v) flag to inject the credential file into the container\n(assumes you have already set your \u003ccode\u003eGOOGLE_APPLICATION_CREDENTIALS\u003c/code\u003e\nenvironment variable on your machine)\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp dir=\"auto\"\u003eUse the --environment (-e) flag to set the \u003ccode\u003eGOOGLE_APPLICATION_CREDENTIALS\u003c/code\u003e\nvariable inside the container\u003c/p\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp dir=\"auto\"\u003eOpen \u003ca href=\"http://localhost:9090\" rel=\"nofollow\"\u003ehttp://localhost:9090\u003c/a\u003e in your browser.\u003c/p\u003e\n\u003c/li\u003e\n\u003c/ol\u003e\n\u003cp dir=\"auto\"\u003eLearn more about \u003ca href=\"https://cloud.google.com/run/docs/testing/local#running_locally_using_docker_with_access_to_services\" rel=\"nofollow\"\u003etesting your container image locally.\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eDeploying\u003c/h2\u003e\u003ca id=\"user-content-deploying\" class=\"anchor\" aria-label=\"Permalink: Deploying\" href=\"#deploying\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003col dir=\"auto\"\u003e\n\u003cli\u003e\n\u003cp dir=\"auto\"\u003e\u003ca href=\"https://github.com/GoogleContainerTools/jib\"\u003eBuild the sample container using Jib\u003c/a\u003e:\u003c/p\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"mvn compile jib:build\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003emvn compile jib:build\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003cstrong\u003eNote\u003c/strong\u003e: Using the image tag \u003ccode\u003egcr.io/PROJECT_ID/SAMPLE_NAME\u003c/code\u003e automatically\npushes the image to \u003ca href=\"https://cloud.google.com/container-registry/\" rel=\"nofollow\"\u003eGoogle Container Registry\u003c/a\u003e.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp dir=\"auto\"\u003eDeploy to Cloud Run by replacing \u003ccode\u003ePROJECT_ID\u003c/code\u003e and \u003ccode\u003eSAMPLE_NAME\u003c/code\u003e with your values:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"gcloud run deploy --image gcr.io/PROJECT_ID/SAMPLE_NAME\"\u003e\u003cpre\u003egcloud run deploy --image gcr.io/PROJECT_ID/SAMPLE_NAME\u003c/pre\u003e\u003c/div\u003e\n\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eNext Steps\u003c/h2\u003e\u003ca id=\"user-content-next-steps\" class=\"anchor\" aria-label=\"Permalink: Next Steps\" href=\"#next-steps\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\n\u003cp dir=\"auto\"\u003eSee \u003ca href=\"https://cloud.google.com/run/docs/building/containers\" rel=\"nofollow\"\u003ebuilding containers\u003c/a\u003e and \u003ca href=\"https://cloud.google.com/run/docs/deploying\" rel=\"nofollow\"\u003edeploying container images\u003c/a\u003e\nfor more information.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp dir=\"auto\"\u003e\u003ca href=\"https://github.com/GoogleContainerTools/jib/tree/master/examples/spring-boot\"\u003eDockerize a Spring Boot app\u003c/a\u003e without a Dockerfile using \u003ca href=\"https://github.com/GoogleContainerTools/jib\"\u003eJib\u003c/a\u003e.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp dir=\"auto\"\u003eTo improve \u003ca href=\"https://cwiki.apache.org/confluence/display/TOMCAT/HowTo+FasterStartUp\" rel=\"nofollow\"\u003eTomcat startup time\u003c/a\u003e, add\n\u003ccode\u003e-Djava.security.egd=file:/dev/./urandom\u003c/code\u003e to the Dockerfile's \u003ccode\u003eCMD\u003c/code\u003e\ninstructions. This is acceptable for many applications. However, if your\napplication does it's own key generation, such as for SSL, and you require\ngreater security, you may prefer to not set \u003ccode\u003ejava.security.egd\u003c/code\u003e.\u003c/p\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/article\u003e","errorMessage":null,"headerInfo":{"toc":[{"level":1,"text":"Google Cloud Run Java Samples","anchor":"google-cloud-run-java-samples","htmlText":"Google Cloud Run Java Samples"},{"level":2,"text":"Samples","anchor":"samples","htmlText":"Samples"},{"level":2,"text":"Jib","anchor":"jib","htmlText":"Jib"},{"level":2,"text":"Setup","anchor":"setup","htmlText":"Setup"},{"level":2,"text":"How to run a sample locally","anchor":"how-to-run-a-sample-locally","htmlText":"How to run a sample locally"},{"level":2,"text":"Deploying","anchor":"deploying","htmlText":"Deploying"},{"level":2,"text":"Next Steps","anchor":"next-steps","htmlText":"Next Steps"}],"siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2Fdeepcodersinc%2Fjava-docs-samples%2Ftree%2Fmaster%2Frun"}},"totalCount":9,"showBranchInfobar":true},"fileTree":{"":{"items":[{"name":".github","path":".github","contentType":"directory"},{"name":".kokoro","path":".kokoro","contentType":"directory"},{"name":"appengine-java11","path":"appengine-java11","contentType":"directory"},{"name":"appengine-java8","path":"appengine-java8","contentType":"directory"},{"name":"asset","path":"asset","contentType":"directory"},{"name":"auth","path":"auth","contentType":"directory"},{"name":"automl","path":"automl","contentType":"directory"},{"name":"bigquery","path":"bigquery","contentType":"directory"},{"name":"bigtable","path":"bigtable","contentType":"directory"},{"name":"cdn","path":"cdn","contentType":"directory"},{"name":"cloud-sql","path":"cloud-sql","contentType":"directory"},{"name":"compute","path":"compute","contentType":"directory"},{"name":"container-registry","path":"container-registry","contentType":"directory"},{"name":"datacatalog","path":"datacatalog","contentType":"directory"},{"name":"dataflow","path":"dataflow","contentType":"directory"},{"name":"datalabeling","path":"datalabeling","contentType":"directory"},{"name":"dataproc","path":"dataproc","contentType":"directory"},{"name":"datastore","path":"datastore","contentType":"directory"},{"name":"dialogflow","path":"dialogflow","contentType":"directory"},{"name":"dlp","path":"dlp","contentType":"directory"},{"name":"endpoints","path":"endpoints","contentType":"directory"},{"name":"errorreporting","path":"errorreporting","contentType":"directory"},{"name":"firestore","path":"firestore","contentType":"directory"},{"name":"flexible","path":"flexible","contentType":"directory"},{"name":"functions","path":"functions","contentType":"directory"},{"name":"healthcare","path":"healthcare","contentType":"directory"},{"name":"iam","path":"iam","contentType":"directory"},{"name":"iap","path":"iap","contentType":"directory"},{"name":"iot","path":"iot","contentType":"directory"},{"name":"jobs","path":"jobs","contentType":"directory"},{"name":"kms","path":"kms","contentType":"directory"},{"name":"language","path":"language","contentType":"directory"},{"name":"logging","path":"logging","contentType":"directory"},{"name":"memorystore","path":"memorystore","contentType":"directory"},{"name":"mlengine","path":"mlengine","contentType":"directory"},{"name":"monitoring","path":"monitoring","contentType":"directory"},{"name":"opencensus","path":"opencensus","contentType":"directory"},{"name":"pubsub","path":"pubsub","contentType":"directory"},{"name":"recommender","path":"recommender","contentType":"directory"},{"name":"run","path":"run","contentType":"directory"},{"name":"secretmanager","path":"secretmanager","contentType":"directory"},{"name":"securitycenter","path":"securitycenter","contentType":"directory"},{"name":"session-handling","path":"session-handling","contentType":"directory"},{"name":"spanner","path":"spanner","contentType":"directory"},{"name":"speech","path":"speech","contentType":"directory"},{"name":"storage","path":"storage","contentType":"directory"},{"name":"tasks","path":"tasks","contentType":"directory"},{"name":"texttospeech","path":"texttospeech","contentType":"directory"},{"name":"trace","path":"trace","contentType":"directory"},{"name":"translate","path":"translate","contentType":"directory"},{"name":"unittests","path":"unittests","contentType":"directory"},{"name":"video","path":"video","contentType":"directory"},{"name":"vision","path":"vision","contentType":"directory"},{"name":".gitignore","path":".gitignore","contentType":"file"},{"name":"CONTRIBUTING.md","path":"CONTRIBUTING.md","contentType":"file"},{"name":"LICENSE","path":"LICENSE","contentType":"file"},{"name":"README.md","path":"README.md","contentType":"file"},{"name":"SAMPLE_FORMAT.md","path":"SAMPLE_FORMAT.md","contentType":"file"},{"name":"build.gradle","path":"build.gradle","contentType":"file"},{"name":"codecov.yml","path":"codecov.yml","contentType":"file"},{"name":"renovate.json","path":"renovate.json","contentType":"file"}],"totalCount":61}},"fileTreeProcessingTime":13.213483,"foldersToFetch":[],"treeExpanded":true,"symbolsExpanded":false,"csrf_tokens":{"/deepcodersinc/java-docs-samples/branches":{"post":"rSzF_KkTC_ReL9Ql71QQs8BQmpB--C1j0He4BzeRgT6lbSsInD0mMQf0-d55umU78WDiPu_B1KCWLTv2ixzf4Q"},"/deepcodersinc/java-docs-samples/branches/fetch_and_merge/master":{"post":"sCDjgAPG-YQ1QuVb-R4nLzjYgbUVzQ1rcLIIp5Nxxhl_FDnN7ufUQCzZdelqwsbPhRMg7IpfNHWCAnxqx4tKyw"},"/deepcodersinc/java-docs-samples/branches/fetch_and_merge/master?discard_changes=true":{"post":"rlJJUYnwA07tdQvPiDQ-xpYiHwjqcXtwbxNnFLp2DKRhZpMcZNEuivTum30b6N8mK-m-UXXjQm6doxPZ7oyAdg"}}},"title":"java-docs-samples/run at master · deepcodersinc/java-docs-samples","appPayload":{"helpUrl":"https://docs.github.com","findFileWorkerPath":"/assets-cdn/worker/find-file-worker-7d7eb7c71814.js","findInFileWorkerPath":"/assets-cdn/worker/find-in-file-worker-1ae9fa256942.js","githubDevUrl":null,"enabled_features":{"code_nav_ui_events":false,"react_blob_overlay":false,"accessible_code_button":true,"github_models_repo_integration":false}}}
0