-
Notifications
You must be signed in to change notification settings - Fork 14
/
Dockerfile
59 lines (46 loc) · 2.42 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
FROM frekele/debian:stable
MAINTAINER frekele <leandro@frekele.org>
# Set environment variables for program versions
ENV JDK_VERSION=8
ENV JDK_UPDATE=181
ENV JDK_BUILD=b13
ENV JDK_DISTRO_ARCH=linux-x64
ENV JCE_FOLDER=UnlimitedJCEPolicyJDK$JDK_VERSION
ENV JDK_FOLDER=jdk1.$JDK_VERSION.0_$JDK_UPDATE
ENV JDK_VERSION_UPDATE=$JDK_VERSION'u'$JDK_UPDATE
ENV JDK_VERSION_UPDATE_BUILD=$JDK_VERSION_UPDATE'-'$JDK_BUILD
ENV JDK_VERSION_UPDATE_DISTRO_ARCH=$JDK_VERSION_UPDATE'-'$JDK_DISTRO_ARCH
ENV JAVA_HOME=/opt/java
ENV JRE_SECURITY_FOLDER=$JAVA_HOME/jre/lib/security
ENV SSL_TRUSTED_CERTS_FOLDER=/opt/ssl/trusted
# Change to tmp folder
WORKDIR /tmp
# Download and extract jdk to opt folder
RUN wget --no-check-certificate https://github.com/frekele/oracle-java/releases/download/${JDK_VERSION_UPDATE_BUILD}/jdk-${JDK_VERSION_UPDATE_DISTRO_ARCH}.tar.gz \
&& wget --no-check-certificate https://github.com/frekele/oracle-java/releases/download/${JDK_VERSION_UPDATE_BUILD}/jdk-${JDK_VERSION_UPDATE_DISTRO_ARCH}.tar.gz.md5 \
&& echo "$(cat jdk-${JDK_VERSION_UPDATE_DISTRO_ARCH}.tar.gz.md5) jdk-${JDK_VERSION_UPDATE_DISTRO_ARCH}.tar.gz" | md5sum -c \
&& tar -zvxf jdk-${JDK_VERSION_UPDATE_DISTRO_ARCH}.tar.gz -C /opt \
&& ln -s /opt/${JDK_FOLDER} /opt/java \
&& rm -f jdk-${JDK_VERSION_UPDATE_DISTRO_ARCH}.tar.gz \
&& rm -f jdk-${JDK_VERSION_UPDATE_DISTRO_ARCH}.tar.gz.md5
# Download zip file with java cryptography extension and unzip to jre security folder
RUN wget --no-check-certificate https://github.com/frekele/oracle-java/releases/download/oracle_jce${JDK_VERSION}/jce_policy-${JDK_VERSION}.zip \
&& unzip jce_policy-${JDK_VERSION}.zip \
&& cp ${JCE_FOLDER}/*.jar ${JRE_SECURITY_FOLDER} \
&& rm -f jce_policy-${JDK_VERSION}.zip \
&& rm -rf ${JCE_FOLDER}
# Add executables to path
RUN update-alternatives --install "/usr/bin/java" "java" "/opt/java/bin/java" 1 && \
update-alternatives --set "java" "/opt/java/bin/java" && \
update-alternatives --install "/usr/bin/javac" "javac" "/opt/java/bin/javac" 1 && \
update-alternatives --set "javac" "/opt/java/bin/javac" && \
update-alternatives --install "/usr/bin/keytool" "keytool" "/opt/java/bin/keytool" 1 && \
update-alternatives --set "keytool" "/opt/java/bin/keytool"
# Create trusted ssl certs folder
RUN mkdir -p $SSL_TRUSTED_CERTS_FOLDER
# Mark as volume
VOLUME $SSL_TRUSTED_CERTS_FOLDER
# Add the files
ADD rootfs /
# Change to root folder
WORKDIR /root