Skip to content
This repository was archived by the owner on Mar 8, 2022. It is now read-only.

Commit b5cfa06

Browse files
committed
Init
0 parents  commit b5cfa06

File tree

8 files changed

+149
-0
lines changed

8 files changed

+149
-0
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*/example*

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.iml
2+
.idea

Dockerfile

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
FROM debian:sid-slim
2+
3+
###### DISCLAIMER ######
4+
#
5+
# You must accept the Oracle Binary Code License Agreement for Java SE to use this image.
6+
#
7+
# Link to License: http://www.oracle.com/technetwork/java/javase/terms/license/index.html
8+
#
9+
###### DISCLAIMER ######
10+
11+
# Set java enviroment
12+
ENV LANG=C.UTF-8 \
13+
JAVA_MAJOR_VERSION=10 \
14+
JAVA_MINOR_VERSION=0 \
15+
JAVA_UPDATE=1 \
16+
JAVA_BUILD=10 \
17+
JAVA_PATH=fb4372174a714e6b8c52526dc134031e \
18+
JAVA_TYPE=jdk
19+
20+
ENV JAVA_FULL_VERSION="${JAVA_MAJOR_VERSION}.${JAVA_MINOR_VERSION}.${JAVA_UPDATE}"
21+
22+
ENV JAVA_HOME="/opt/java/${JAVA_TYPE}-${JAVA_FULL_VERSION}" \
23+
JAVA_TAR="${JAVA_TYPE}-${JAVA_FULL_VERSION}_linux-x64_bin.tar.gz"
24+
25+
# Download oracle jre -> extract it -> add app user & group -> cleanup
26+
# You can use USER 'app' for you app
27+
RUN cd /tmp \
28+
&& apt-get update \
29+
&& apt-get install -y wget \
30+
&& mkdir -p $JAVA_HOME \
31+
&& wget --header "Cookie: oraclelicense=accept-securebackup-cookie;" \
32+
--progress=dot:mega --tries=10 "http://download.oracle.com/otn-pub/java/jdk/${JAVA_FULL_VERSION}+${JAVA_BUILD}/${JAVA_PATH}/${JAVA_TAR}" \
33+
&& tar -xzf $JAVA_TAR -C /opt/java \
34+
&& ln -s $JAVA_HOME $JAVA_HOME/bin/* /usr/bin/ \
35+
&& rm -rf $JAVA_HOME/*src.zip \
36+
$JAVA_HOME/lib/missioncontrol \
37+
$JAVA_HOME/lib/*javafx* \
38+
$JAVA_HOME/lib/*jfx* \
39+
$JAVA_HOME/lib/*awt* \
40+
$JAVA_HOME/lib/desktop \
41+
$JAVA_HOME/lib/javaws.jar \
42+
$JAVA_HOME/lib/plugin.jar \
43+
$JAVA_HOME/lib/plugin-legacy.jar \
44+
$JAVA_HOME/lib/javaws.jar \
45+
$JAVA_HOME/lib/desktop \
46+
$JAVA_HOME/lib/deploy \
47+
$JAVA_HOME/lib/deploy* \
48+
$JAVA_HOME/lib/fonts \
49+
$JAVA_HOME/lib/oblique-fonts \
50+
$JAVA_HOME/jmods/*javafx* \
51+
$JAVA_HOME/jmods/*javaws* \
52+
&& apt-get remove -y wget \
53+
&& apt-get clean -y \
54+
&& apt-get autoremove -y \
55+
&& apt-get autoclean -y \
56+
&& rm -rf /tmp/* \
57+
&& rm -rf /var/cache/apt/archives/* \
58+
&& useradd -ms /bin/bash app
59+
60+
# Add java to path
61+
ENV PATH $PATH:$JAVA_HOME/bin

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 GoodforGod
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Docker Debian Oracle JDK 10
2+
Docker Debian Slim image with cleaned Oracle JDK 10 Update 1 (239MB for stretch)
3+
4+
You must accept the [Oracle Binary Code License Agreement for Java SE](http://www.oracle.com/technetwork/java/javase/terms/license/index.html) to use this image.
5+
6+
## Image
7+
Image contains cleaned [Oracle JDK 10.0.1](http://www.oracle.com/technetwork/java/javase/downloads/jdk10-downloads-4416644.html).
8+
JDK is provided without *desktop, sources* and other unnecessary stuff except JVM.
9+
So image have all *JVM* parts to run *Java applications* in Docker containers.
10+
11+
There are two base images:
12+
13+
#### Latest
14+
Uses base image [Debian Sid Slim](https://hub.docker.com/_/debian/) (63.3MB)
15+
16+
Image size with JDK (254MB)
17+
18+
#### Stretch
19+
Uses base image [Debian Stretch Slim](https://hub.docker.com/_/debian/) (55.3MB)
20+
21+
Image size with JDK (239MB)
22+
23+
## Usage
24+
Image have docker *USER* named **app** so you can use it for your application.
25+
26+
Just add code below in your *Dockerfile* to use start your application as a user *app*
27+
```
28+
USER app
29+
```
30+
31+
Check [example](https://github.com/GoodforGod/https://github.com/GoodforGod/docker-debian-jre10server-oracle/tree/master/example) folder for *Dockerfile* example of image usage.

example/Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM goodforgod/debian-jdk10-oracle
2+
3+
COPY helloworld-1.0.0.jar /
4+
VOLUME /tmp/logs
5+
6+
USER app
7+
8+
ENTRYPOINT ["java", "-jar", "/helloworld-1.0.0.jar"]

example/helloworld-1.0.0.jar

16.8 MB
Binary file not shown.

example/run.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
3+
DOCKERFILE=Dockerfile
4+
CONT_NAME=helloworld
5+
IMAGE_NAME=helloworld
6+
7+
CONT_ID=$(sudo docker ps -a -q --filter ancestor=$CONT_NAME)
8+
9+
if [ -z "$CONT_ID" ]
10+
then
11+
echo 'Container is not exist'
12+
13+
else
14+
echo "[Removing] container with ID - $CONT_ID"
15+
16+
sudo docker stop $CONT_ID
17+
sudo docker rm $CONT_ID
18+
sudo docker rmi $IMAGE_NAME
19+
fi
20+
21+
echo '[Redeploying]'
22+
23+
sudo docker build --tag=$IMAGE_NAME - < $DOCKERFILE
24+
sudo docker run -d --name $CONT_NAME -p 8080:8080 $IMAGE_NAME
25+
sudo docker ps

0 commit comments

Comments
 (0)