Giter VIP home page Giter VIP logo

dockerfile-java-runtime's Introduction

Minimal Java Runtime Environment

REPOSITORY IS NO LONGER MAINTAINED

These days there is plenty of choice for Java Runtime Environments on Docker, most notably the official openjdk Docker repository, so there is no more need for this one.

Not all base images contain Bash, which is quite convenient if you want to launch Play Framework applications with its Bash launch script, but the *-jre-slim images do. For example, you could use a Dockerfile like this to dockerize your Play web application:

FROM openjdk:8u171-jre-slim
WORKDIR /app
COPY target/universal/stage/ .
COPY public/ ./public
EXPOSE 9000
CMD ["bin/name-of-launch-script"]

Good luck! This repository will now be archived.

If you need a helping hand with your web project, get in touch. ๐Ÿ˜‰

General

Good to go for Play Framework apps and other stuff, of course.

Since the official Java repository on Docker Hub now also has minimal images based on Alpine Linux, there is not much point in maintaining this repository any longer.

OpenJDK JRE 8 (including Bash)

Less than 120 MB image: cloudunder/java-runtime:openjdk8

The only difference to the official java:8-jre-alpine image is that this one has bash installed, which is handy to start a Play application using the bash script that comes with a build (e.g. sbt stage).

JRE 7

No longer maintained.

A very small Docker image with a Java Runtime Environment (OpenJDK 7) based on Alpine Linux. We also installed the Bash shell, because we want to use this as a base image for Play Framework web applications and the standard start script of a Play app is a Bash script.

How to use this image

Examples:

# Pull the image from Docker Hub:
docker pull cloudunder/java-runtime:7

# Print the version and exit:
docker run --rm cloudunder/java-runtime:7 java -version

A sample Dockerfile for a Play Framework application:

FROM cloudunder/java-runtime:openjdk8

WORKDIR /app
COPY target/universal/stage/ .
EXPOSE 9000
CMD ["bin/appname"]

Containerise the Play app:

# Compile the app in stage mode
# In your Play app's directory:
./activator stage

# Build a container with the app
docker build -t yourappimagename .

Run the Play app in the Docker container:

# To make web application accessible with a random port:
docker run -P -t yourappimagename

# To bind public port 80 to the app's port 9000:
docker run -p 80:9000 -t yourappimagename

Now you should be able to open the app in your browser.

dockerfile-java-runtime's People

Contributors

manc avatar

Watchers

 avatar  avatar

Forkers

abbtek

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.