{"id":20796743,"url":"https://github.com/vertx-howtos/executable-jar-docker-howto","last_synced_at":"2026-02-11T16:02:06.543Z","repository":{"id":53731390,"uuid":"348069899","full_name":"vertx-howtos/executable-jar-docker-howto","owner":"vertx-howtos","description":"Creating a container for a Vert.x app packaged as an executable uber-jar","archived":false,"fork":false,"pushed_at":"2024-12-02T17:19:13.000Z","size":334,"stargazers_count":0,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-09T19:46:45.870Z","etag":null,"topics":["docker","executable-jar","howto","vertx"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vertx-howtos.png","metadata":{"files":{"readme":"README.adoc","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-15T17:51:57.000Z","updated_at":"2024-12-04T17:04:42.000Z","dependencies_parsed_at":"2025-04-10T00:15:28.539Z","dependency_job_id":null,"html_url":"https://github.com/vertx-howtos/executable-jar-docker-howto","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":"vertx-howtos/howto-template","purl":"pkg:github/vertx-howtos/executable-jar-docker-howto","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vertx-howtos%2Fexecutable-jar-docker-howto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vertx-howtos%2Fexecutable-jar-docker-howto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vertx-howtos%2Fexecutable-jar-docker-howto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vertx-howtos%2Fexecutable-jar-docker-howto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vertx-howtos","download_url":"https://codeload.github.com/vertx-howtos/executable-jar-docker-howto/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vertx-howtos%2Fexecutable-jar-docker-howto/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29337001,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-11T16:00:30.228Z","status":"ssl_error","status_checked_at":"2026-02-11T16:00:25.398Z","response_time":97,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","executable-jar","howto","vertx"],"created_at":"2024-11-17T16:28:55.290Z","updated_at":"2026-02-11T16:02:06.526Z","avatar_url":"https://github.com/vertx-howtos.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"= Creating a container for a Vert.x app packaged as an executable uber-jar\n:page-permalink: /\n:page-github: vertx-howtos/executable-jar-docker-howto\n\nifdef::env-github[]\nimage:https://github.com/vertx-howtos/executable-jar-docker-howto/actions/workflows/publish.yml/badge.svg[\"Publish the how-to\", link=\"https://github.com/vertx-howtos/executable-jar-docker-howto/actions/workflows/publish.yml\"]\nendif::env-github[]\n\n== What you will create\n\nYou will create a container for a Vert.x app packaged as an executable https://stackoverflow.com/a/11947093/2133695[_uber-jar_].\n\nThe how-to consists in a couple of files:\n\n. the `docker-maven/Dockerfile`, for Maven users, or\n. the `docker-gradle/Dockerfile`, for Gradle users.\n\n== What you need\n\n* A text editor or IDE\n* Docker\n\n== Using Maven\n\n=== Generate the project\n\nFirst, generate the project from https://start.vertx.io:\n\n. Select the `Maven` build type\n. Set the `artifactId` to `container-uber-jar`\n. Select the `JDK 11` JDK version\n. Click on generate and extract the content somewhere on your disk\n\nAlternatively, open a terminal and run:\n\n[source,bash]\n----\ncurl -G https://start.vertx.io/starter.zip -d \"artifactId=container-uber-jar\" -d \"jdkVersion=11\" -d \"buildTool=maven\" --output container-uber-jar.zip\nunzip container-uber-jar.zip\n----\n\nOr, with HTTPie:\n\n[source,bash]\n----\nhttp https://start.vertx.io/starter.zip artifactId==container-uber-jar jdkVersion==11 buildTool==maven --output container-uber-jar.zip\nunzip container-uber-jar.zip\n----\n\n=== Configuring the Docker build\n\nAt the root of the project, create a `docker-maven/Dockerfile` build file:\n\nifdef::env-github[]\nlink:docker-maven/Dockerfile[Docker build file for a Maven project]\nendif::env-github[]\nifndef::env-github[]\n[source,dockerfile]\n.Docker build file for a Maven project\n----\ninclude::docker-maven/Dockerfile[]\n----\nendif::env-github[]\n\nThe Docker build has two stages:\n\n. Building the Maven project inside a `maven:3.9.9-eclipse-temurin-11` container\n. Copying the output of the build in a `eclipse-temurin:11` container and configuring the entry point\n\nThe benefits of this approach are:\n\n- reproducible build: no matter who in the team runs the Docker build, it will always use the same Maven version and JDK version (both at build-time and run-time)\n- small container image size: the final container will be based on a slim JDK image and will only add the uber-jar file\n\nTo build the container, open a terminal at the root of the project and run:\n\n[source,bash]\n----\ndocker build -t com.example/container-uber-jar -f docker-maven/Dockerfile .\n----\n\n== Using Gradle\n\n=== Generate the project\n\nFirst, generate the project from https://start.vertx.io:\n\n. Select the `Gradle` build type\n. Set the `artifactId` to `container-uber-jar`\n. Select the `JDK 11` JDK version\n. Click on generate and extract the content somewhere on your disk\n\nAlternatively, open a terminal and run:\n\n[source,bash]\n----\ncurl -G https://start.vertx.io/starter.zip -d \"artifactId=container-uber-jar\" -d \"jdkVersion=11\" -d \"buildTool=gradle\" --output container-uber-jar.zip\nunzip container-uber-jar.zip\n----\n\nOr, with HTTPie:\n\n[source,bash]\n----\nhttp https://start.vertx.io/starter.zip artifactId==container-uber-jar jdkVersion==11 buildTool==gradle --output container-uber-jar.zip\nunzip container-uber-jar.zip\n----\n\n=== Configuring the Docker build\n\nAt the root of the project, create a `docker-gradle/Dockerfile` build file:\n\nifdef::env-github[]\nlink:docker-gradle/Dockerfile[Docker build file for a Gradle project]\nendif::env-github[]\nifndef::env-github[]\n[source,dockerfile]\n.Docker build file for a Gradle project\n----\ninclude::docker-gradle/Dockerfile[]\n----\nendif::env-github[]\n\nThe Docker build has two stages:\n\n. Building the Gradle project inside a `gradle:8.1.1-jdk11` container\n. Copying the output of the build in a `eclipse-temurin:11` container and configuring the entry point\n\nThe benefits of this approach are:\n\n- reproducible build: no matter who in the team runs the Docker build, it will always use the same Gradle version and JDK version (both at build-time and run-time)\n- small container image size: the final container will be based on a slim JDK image and will only add the uber-jar file\n\nTo build the container, open a terminal at the root of the project and run:\n\n[source,bash]\n----\ndocker build -t com.example/container-uber-jar -f docker-gradle/Dockerfile .\n----\n\n== Running the application\n\nNow that you have built the container image, it is time to try it out!\n\nOpen a terminal and run:\n\n[source,bash]\n----\ndocker run -p 8888:8888 com.example/container-uber-jar\n----\n\nYou should see messages like these on the console output:\n\n----\nHTTP server started on port 8888\nDec 02, 2024 5:17:19 PM io.vertx.launcher.application.VertxApplication\nINFO: Succeeded in deploying verticle\n----\n\nThen browse to http://localhost:8888 and get your greeting from the Vert.x app running in the container!\n\n== Summary\n\nThis document covered:\n\n. configuring a Docker build for Maven users,\n. configuring a Docker build for Gradle users.\n\n== See also\n\n- https://docs.docker.com/engine/reference/builder/[Dockerfile reference]\n- https://docs.docker.com/develop/develop-images/multistage-build/[Multi-stage builds introduction]\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvertx-howtos%2Fexecutable-jar-docker-howto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvertx-howtos%2Fexecutable-jar-docker-howto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvertx-howtos%2Fexecutable-jar-docker-howto/lists"}