{"id":6048,"date":"2018-03-25T13:16:32","date_gmt":"2018-03-25T13:16:32","guid":{"rendered":"http:\/\/putridparrot.com\/blog\/?p=6048"},"modified":"2018-03-25T13:16:32","modified_gmt":"2018-03-25T13:16:32","slug":"lets-create-a-vert-x-docker-image-of-our-application","status":"publish","type":"post","link":"https:\/\/putridparrot.com\/blog\/lets-create-a-vert-x-docker-image-of-our-application\/","title":{"rendered":"Let&#8217;s create a Vert.x docker image of our application"},"content":{"rendered":"<p>As you&#8217;ve probably realised from previous posts, I&#8217;m very much into the idea of deploying my server applications via Docker, so let&#8217;s take the VertxTest application and create a Docker image with it.<\/p>\n<p>Thankfully we do not need to start our Dockerfile by creating a base OS then adding Java etc. The people writing Vert.x have kindly implemented a base image for us.<\/p>\n<p>See <a href=\"https:\/\/vertx.io\/docs\/vertx-docker\/#_deploying_a_java_verticle_in_a_docker_container\" rel=\"noopener\" target=\"_blank\">Deploying a Java verticle in a docker container<\/a>.<\/p>\n<p>If we take the example Dockerfile from their website and make the changes for our application (just replace VERTICAL_NAME and VERTICLE_FILE with our main verticle and the JAR) we get the following file<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\nFROM vertx\/vertx3\r\n\r\nENV VERTICLE_NAME com.putridparrot.MainVerticle\r\nENV VERTICLE_FILE VertxTest-1.0-SNAPSHOT-fat.jar\r\n\r\nENV VERTICLE_HOME .\r\n\r\nEXPOSE 8080\r\n\r\nCOPY $VERTICLE_FILE $VERTICLE_HOME\/\r\n\r\nWORKDIR $VERTICLE_HOME\r\nENTRYPOINT &#x5B;&quot;sh&quot;, &quot;-c&quot;]\r\nCMD &#x5B;&quot;exec vertx run $VERTICLE_NAME -cp $VERTICLE_HOME\/*&quot;]\r\n<\/pre>\n<p>Place this Dockerfile into a folder along with the compiled JAR and then execute<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\ndocker build -t vertx_test  .\r\n<\/pre>\n<p>This creates an image name vertx_test which we can now execute. If you want to watch the output from our <em>System.out.println<\/em> execute<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\ndocker run -it -p 8080:8080 vertx_test\r\n<\/pre>\n<p>Once you see the <em>HTTP server started on port 8080<\/em> outputs, the Vert.x application will be ready for you to access via your preferred web browser etc. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>As you&#8217;ve probably realised from previous posts, I&#8217;m very much into the idea of deploying my server applications via Docker, so let&#8217;s take the VertxTest application and create a Docker image with it. Thankfully we do not need to start our Dockerfile by creating a base OS then adding Java etc. The people writing Vert.x [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[102,210],"tags":[],"class_list":["post-6048","post","type-post","status-publish","format-standard","hentry","category-docker","category-vert-x"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/6048","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/comments?post=6048"}],"version-history":[{"count":3,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/6048\/revisions"}],"predecessor-version":[{"id":6051,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/6048\/revisions\/6051"}],"wp:attachment":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/media?parent=6048"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/categories?post=6048"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/tags?post=6048"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}