GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - venkat198910/java-docker-build-tutorial: A template project to create a minimal Docker image for a Java application

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

16 Commits
16 Commits

Folders and files

NameName
Last commit message
Last commit date
src
src
 
 
.travis.yml
.travis.yml
 
 
Dockerfile
Dockerfile
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
create_image.sh
create_image.sh
 
 
pom.xml
pom.xml
 
 
start_container.sh
start_container.sh
 
 

Repository files navigation

Tutorial: Create a Docker image for a Java application

Build Status License

A template project to create a Docker image for a Java application. The example application exposes an HTTP endpoint.

The Docker build uses a multi-stage build setup to minimize the size of the generated Docker image.

Golang developer? Check out https://github.com/miguno/golang-docker-build-tutorial

Requirements

Docker must be installed. That's it. You do not need a Java JDK or Maven installed.

Usage and Demo

Step 1: Create the Docker image according to Dockerfile. This step uses Maven to build, test, and package the Java application according to pom.xml. The resulting image is 87MB in size.

# This may take a few minutes.
$ docker build -t miguno/java-docker-build-tutorial:latest .

Step 2: Start a container for the Docker image.

$ docker run -p 8123:8123 miguno/java-docker-build-tutorial:latest

Step 3: Open another terminal and access the example API endpoint.

$ curl http://localhost:8123/status
{"status": "idle"}

Notes

You can also build, test, package, and run the Java application locally (without Docker) if you have JDK 8+ and Maven installed.

# Build, test, package the application locally
$ mvn package

# Run the application locally
$ java -jar target/app.jar

About

A template project to create a minimal Docker image for a Java application

Resources

Readme
Apache-2.0 license
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.