Skip to content
This repository has been archived by the owner on Feb 17, 2023. It is now read-only.

Commit

Permalink
Merge pull request #3 from airdock-io/develop
Browse files Browse the repository at this point in the history
Adding multiple JDK version and stable tag
  • Loading branch information
geronimo-iia committed Jan 20, 2016
2 parents 498f1dd + 96e6ebc commit f85d1c9
Show file tree
Hide file tree
Showing 114 changed files with 4,113 additions and 49 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
.git
.idea
*.md
Makefile
LICENSE
src
32 changes: 32 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,35 @@
Session.vim
.netrwhist
*~


### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm

*.iml

## Directory-based project format:
.idea/

## File-based project format:
*.ipr
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

build
1 change: 0 additions & 1 deletion Dockerfile

This file was deleted.

26 changes: 26 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# VERSION 1.1
# AUTHOR: Jerome Guibert <jguibert@gmail.com>
# DESCRIPTION: Oracle Java 8u66
# TO_BUILD: make build
# SOURCE: https://github.com/airdock-io/docker-oracle-jdk/tree/master/jdk-8u66

FROM airdock/base:latest
MAINTAINER Jerome Guibert <jguibert@gmail.com>

# Add java dynamic memory script
COPY java-dynamic-memory-opts /srv/java/

# Install Oracle JDK 8u66
RUN cd /srv/java && \
curl -L -O -H "Cookie: oraclelicense=accept-securebackup-cookie" -k "http://download.oracle.com/otn-pub/java/jdk/8u66-b17/jdk-8u66-linux-x64.tar.gz" && \
tar xvf jdk-8u66-linux-x64.tar.gz -C /srv/java && \
rm -f jdk-8u66-linux-x64.tar.gz && \
ln -s /srv/java/jdk1.* /srv/java/jdk && \
chown -R java:java /srv/java && \
/root/post-install

# Define commonly used JAVA_HOME variable
ENV JAVA_HOME /srv/java/jdk

# Add /srv/java and jdk on PATH variable
ENV PATH ${PATH}:${JAVA_HOME}/bin:/srv/java
63 changes: 50 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,54 @@
DIRS := oracle-java7 oracle-java8
BUILD_DIRS := $(addsuffix .build,$(DIRS))
CLEAN_DIRS := $(addsuffix .clean,$(DIRS))
NAMESPACE = airdock
NAME = oracle-jdk
FULLNAME = $(NAMESPACE)/$(NAME)
VERSION = 8u66

build: $(BUILD_DIRS)
$(BUILD_DIRS):
@echo $@
$(MAKE) -C $(basename $@) build
.PHONY: all clean build tag_latest release debug run save start usage

all: usage build

clean: $(CLEAN_DIRS)
$(CLEAN_DIRS):
@echo $@
$(MAKE) -C $(basename $@) clean
clean:
@CID=$(docker ps -a | awk '{ print $$1 " " $$2 }' | grep $(FULLNAME) | awk '{ print $$1 }'); if [ ! -z "$$CID" ]; then echo "Removing container which reference $(FULLNAME)"; for container in $(CID); do docker rm -f $$container; done; fi;
@echo "Removing image $(FULLNAME)"
@if docker images $(FULLNAME) | awk '{ print $$2 }' | grep -q -F $(VERSION); then docker rmi -f $(FULLNAME):$(VERSION); fi
@if docker images $(FULLNAME) | awk '{ print $$2 }' | grep -q -F latest; then docker rmi -f $(FULLNAME):latest; fi


.PHONY: build $(BUILD_DIRS) clean $(CLEAN_DIRS)

build: clean
docker build -t $(FULLNAME):$(VERSION) --rm .

tag_latest:
@docker tag $(FULLNAME):$(VERSION) $(FULLNAME):latest

release: build tag_latest
docker push $(FULLNAME)
@echo "Create a tag v-$(VERSION)"
@git tag v-$(VERSION)
@git push origin v-$(VERSION)

debug:
@docker run -t -i $(FULLNAME):$(VERSION) /bin/bash

save:
@OUTPUT_FILE = $(NAME)_$(VERSION)_`date +%Y%m%d%H%M%S`.tgz
@docker save $(FULLNAME):$(VERSION) | gzip --best --stdout > $(OUTPUT_FILE)
@echo "Image $(FULLNAME):$(VERSION) exported to $(OUTPUT_FILE)"

run:
@echo "IPAddress =" $$(docker inspect --format '{{.NetworkSettings.IPAddress}}' $$(docker run -d $(FULLNAME):$(VERSION)))

start:
@docker-machine start default
@eval "$(docker-machine env default)"

usage:
@echo "List of target"
@echo "all (default): print usage and build"
@echo "clean: remove containers and image"
@echo "build: build docker image"
@echo "tag_latest: build and tag image with 'latest'"
@echo "debug: launch a shell with this image"
@echo "save: export this image"
@echo "run: launch this image with inner command"
@echo "start: start docker machine"
@echo "usage: this help"
2 changes: 1 addition & 1 deletion README-short.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Oracle Java

Docker Image for Oracle Java 8 and 7
Docker Image for Oracle Java SDK
86 changes: 62 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,64 +1,102 @@
# Oracle Java [![](https://badge.imagelayers.io/airdock/oracle-jdk:latest.svg)](https://imagelayers.io/?images=airdock/oracle-jdk:latest 'Get your own badge on imagelayers.io')

Docker Image for Oracle Java 8 and 7 based on airdock/base:latest

This repository contains **Dockerfile** for [Docker](https://www.docker.com/)'s [automated build](https://registry.hub.docker.com/u/airdock/) published to the public [Docker Hub Registry](https://registry.hub.docker.com/).

Docker Image for Oracle Java SDK based on airdock/base:latest

> Name: airdock/oracle-jdk:1.8 (or airdock/oracle-jdk:latest) and airdock/oracle-jdk:1.7
This repository contains **Dockerfile** for [Docker](https://www.docker.com/)'s [automated build](https://registry.hub.docker.com/u/airdock/) published to the public [Docker Hub Registry](https://registry.hub.docker.com/).

**Dependency**: airdock/base:latest

**Few links**:

- [Docker Java Image](https://github.com/dockerfile/java)

## Supported Version

> [airdock/oracle-jdk:latest](https://github.com/airdock-io/docker-oracle-jdk/tree/master/) (jdk-8u66) [![](https://badge.imagelayers.io/airdock/oracle-jdk:latest.svg)](https://imagelayers.io/?images=airdock/oracle-jdk:latest 'Get your own badge on imagelayers.io')
- [airdock/oracle-jdk:1.8](https://github.com/airdock-io/docker-oracle-jdk/tree/master/jdk-1.8) (jdk-8u66) [![](https://badge.imagelayers.io/airdock/oracle-jdk:1.8.svg)](https://imagelayers.io/?images=airdock/oracle-jdk:1.8 'Get your own badge on imagelayers.io')

- [airdock/oracle-jdk:1.7](https://github.com/airdock-io/docker-oracle-jdk/tree/master/jdk-1.7) (jdk-8u66) [![](https://badge.imagelayers.io/airdock/oracle-jdk:1.7.svg)](https://imagelayers.io/?images=airdock/oracle-jdk:1.7 'Get your own badge on imagelayers.io')


- [airdock/oracle-jdk:jdk-8u66](https://github.com/airdock-io/docker-oracle-jdk/tree/master/jdk-8u66) [![](https://badge.imagelayers.io/airdock/oracle-jdk:jdk-8u66.svg)](https://imagelayers.io/?images=airdock/oracle-jdk:jdk-8u66 'Get your own badge on imagelayers.io')
- [airdock/oracle-jdk:jdk-8u65](https://github.com/airdock-io/docker-oracle-jdk/tree/master/jdk-8u65) [![](https://badge.imagelayers.io/airdock/oracle-jdk:jdk-8u65.svg)](https://imagelayers.io/?images=airdock/oracle-jdk:jdk-8u65 'Get your own badge on imagelayers.io')
- [airdock/oracle-jdk:jdk-8u60](https://github.com/airdock-io/docker-oracle-jdk/tree/master/jdk-8u60) [![](https://badge.imagelayers.io/airdock/oracle-jdk:jdk-8u60.svg)](https://imagelayers.io/?images=airdock/oracle-jdk:jdk-8u60 'Get your own badge on imagelayers.io')
- [airdock/oracle-jdk:jdk-8u51](https://github.com/airdock-io/docker-oracle-jdk/tree/master/jdk-8u51) [![](https://badge.imagelayers.io/airdock/oracle-jdk:jdk-8u51.svg)](https://imagelayers.io/?images=airdock/oracle-jdk:jdk-8u51 'Get your own badge on imagelayers.io')
- [airdock/oracle-jdk:jdk-8u45](https://github.com/airdock-io/docker-oracle-jdk/tree/master/jdk-8u45) [![](https://badge.imagelayers.io/airdock/oracle-jdk:jdk-8u45.svg)](https://imagelayers.io/?images=airdock/oracle-jdk:jdk-8u45 'Get your own badge on imagelayers.io')
- [airdock/oracle-jdk:jdk-8u40](https://github.com/airdock-io/docker-oracle-jdk/tree/master/jdk-8u40) [![](https://badge.imagelayers.io/airdock/oracle-jdk:jdk-8u40.svg)](https://imagelayers.io/?images=airdock/oracle-jdk:jdk-8u40 'Get your own badge on imagelayers.io')
- [airdock/oracle-jdk:jdk-8u31](https://github.com/airdock-io/docker-oracle-jdk/tree/master/jdk-8u31) [![](https://badge.imagelayers.io/airdock/oracle-jdk:jdk-8u31.svg)](https://imagelayers.io/?images=airdock/oracle-jdk:jdk-8u31 'Get your own badge on imagelayers.io')
- [airdock/oracle-jdk:jdk-8u25](https://github.com/airdock-io/docker-oracle-jdk/tree/master/jdk-8u25) [![](https://badge.imagelayers.io/airdock/oracle-jdk:jdk-8u25.svg)](https://imagelayers.io/?images=airdock/oracle-jdk:jdk-8u25 'Get your own badge on imagelayers.io')
- [airdock/oracle-jdk:jdk-7u80](https://github.com/airdock-io/docker-oracle-jdk/tree/master/jdk-7u80) [![](https://badge.imagelayers.io/airdock/oracle-jdk:jdk-7u80.svg)](https://imagelayers.io/?images=airdock/oracle-jdk:jdk-7u80 'Get your own badge on imagelayers.io')
- [airdock/oracle-jdk:jdk-7u79](https://github.com/airdock-io/docker-oracle-jdk/tree/master/jdk-7u79) [![](https://badge.imagelayers.io/airdock/oracle-jdk:jdk-7u79.svg)](https://imagelayers.io/?images=airdock/oracle-jdk:jdk-7u79 'Get your own badge on imagelayers.io')



# Usage
## Usage

You should have already install [Docker](https://www.docker.com/).

Execute:

'docker run -t -i airdock/oracle-jdk:1.8 java -version'
'docker run -t -i airdock/oracle-jdk:latest java -version'

Please note that a correct docker command should be something like this one (using java user defined):

You can run your java application with java:java user (define in airdock/base) :
```
CMD [ "gosu", "java:java", "/srv/java/jdk/bin/java", ... ]
```

JVM uses only 1/4 of system memory by default, with script java-dynamic-memory-opts,
you could set a specific percent of memory (80 % per default) :

gosu java:java java -jar /var/lib/java/myapplication.jar
```
CMD [ "gosu", "java:java", "/srv/java/jdk/bin/java", "$(/srv/java/java-dynamic-memory-opts)", ... ]
or
CMD [ "gosu", "java:java", "/srv/java/jdk/bin/java", "$(/srv/java/java-dynamic-memory-opts 90)", ... ]
```
If you using this script take care of your host sizing.


## Change Log

### 1.1

# Change Log
- add specific tag on SDK version
- add build process to generate all JDK version target
- add JAVA_HOME/bin in PATH, java-dynamic-memory-opts utility script for all version
- Use tarball from Oracle in order to install JDK
- JDK HOME is bellow /srv/java/jdk

## Tag 1.8 and latest (current)
### 1.0

- add java-dynamic-memory-opts utility script
- add java:java user
- add JAVA_HOME/bin in PATH
- add java-dynamic-memory-opts utility script (on 1.8 and latest version only)
- add webupd8team key
- add oracle jdk 8
- add oracle jdk 8 and jdk 7
- declare JAVA_HOME
- use MIT license

## Tag: 1.7

- add java:java user
- add webupd8team key
- add oracle jdk 7
- declare JAVA_HOME
- use MIT license
## Build

# Build
You should install "make" utility.

Under each project, you could retrieve a Makefile with a set of *tasks*:

- Install "make" utility, and execute: `make build`
- Or execute: 'docker build -t airdock/oracle-jdk8:latest --rm .'
- **all**: alias to 'build'
- **clean**: remove all container which depends on this image, and remove image previously builded
- **build**: clean and build the current version
- **tag_latest**: tag current version with ":latest"
- **release**: build and execute tag_latest, push image onto registry, and tag git repository
- **debug**: launch an interactive shell using this image
- **run**: run image as daemon and print IP address.
- **save**: export docker image as a tar.gz file

See [Docker Project Tree](https://github.com/airdock-io/docker-base/wiki/Docker-Project-Tree) for more details.


# MIT License
## MIT License

```
The MIT License (MIT)
Expand All @@ -82,4 +120,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
```
```
18 changes: 18 additions & 0 deletions java-dynamic-memory-opts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh
# example usage:
# exec java $(java-dynamic-memory-opts 80) -jar myfatjar.jar

# JVM uses only 1/4 of system memory by default
DEFAULT_MEM_JAVA_PERCENT=80

if [ -n "$1" ]
then
MEM_JAVA_PERCENT=$1
else
MEM_JAVA_PERCENT=$DEFAULT_MEM_JAVA_PERCENT
fi

MEM_TOTAL_KB=$(cat /proc/meminfo | grep MemTotal | awk '{print $2}')
MEM_JAVA_KB=$(($MEM_TOTAL_KB * $MEM_JAVA_PERCENT / 100))

echo "-Xmx${MEM_JAVA_KB}k"
6 changes: 6 additions & 0 deletions jdk-1.7/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.git
.idea
*.md
Makefile
LICENSE
src
41 changes: 41 additions & 0 deletions jdk-1.7/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Created by https://www.gitignore.io

### vim ###
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
*.un~
Session.vim
.netrwhist
*~


### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm

*.iml

## Directory-based project format:
.idea/

## File-based project format:
*.ipr
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

build
26 changes: 26 additions & 0 deletions jdk-1.7/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# VERSION 1.1
# AUTHOR: Jerome Guibert <jguibert@gmail.com>
# DESCRIPTION: Oracle Java 7u80
# TO_BUILD: make build
# SOURCE: https://github.com/airdock-io/docker-oracle-jdk/tree/master/jdk-7u80

FROM airdock/base:latest
MAINTAINER Jerome Guibert <jguibert@gmail.com>

# Add java dynamic memory script
COPY java-dynamic-memory-opts /srv/java/

# Install Oracle JDK 7u80
RUN cd /srv/java && \
curl -L -O -H "Cookie: oraclelicense=accept-securebackup-cookie" -k "http://download.oracle.com/otn-pub/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gz" && \
tar xvf jdk-7u80-linux-x64.tar.gz -C /srv/java && \
rm -f jdk-7u80-linux-x64.tar.gz && \
ln -s /srv/java/jdk1.* /srv/java/jdk && \
chown -R java:java /srv/java && \
/root/post-install

# Define commonly used JAVA_HOME variable
ENV JAVA_HOME /srv/java/jdk

# Add /srv/java and jdk on PATH variable
ENV PATH ${PATH}:${JAVA_HOME}/bin:/srv/java
21 changes: 21 additions & 0 deletions jdk-1.7/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2015 Airdock.io

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Loading

0 comments on commit f85d1c9

Please sign in to comment.