This repository has been archived by the owner on Jan 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
130 lines (120 loc) · 6.37 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#fork from https://github.com/anapsix/docker-alpine-java/blob/master/8/111b14/jdk/unlimited/Dockerfile
# AlpineLinux with a glibc-2.29-r0 and Oracle Java 8
FROM alpine:3.8
# MAINTAINER Anastas Dancha <anapsix@random.io>
# thanks to Vladimir Krivosheev <develar@gmail.com> aka @develar for smaller image
# and Victor Palma <palma.victor@gmail.com> aka @devx for pointing it out
# Java Version and other ENV
ENV JAVA_VERSION_MAJOR=8 \
JAVA_VERSION_MINOR=111 \
JAVA_VERSION_BUILD=14 \
JAVA_PACKAGE=jdk \
JAVA_JCE=unlimited \
JAVA_HOME=/opt/jdk \
PATH=${PATH}:/opt/jdk/bin \
GLIBC_REPO=https://github.com/sgerrand/alpine-pkg-glibc \
GLIBC_VERSION=2.29-r0 \
LANG=C.UTF-8
# do all in one step
RUN set -ex && \
[[ ${JAVA_VERSION_MAJOR} != 7 ]] || ( echo >&2 'Oracle no longer publishes JAVA7 packages' && exit 1 ) && \
#Remarked by Alex \
#apk -U upgrade && \
#Alex added --no-cache
apk --no-cache add libstdc++=6.4.0-r9 curl=7.61.1-r3 ca-certificates=20190108-r0 bash=4.4.19-r1 && \
#Added by Alex \
#Alex added --no-cache
apk --no-cache add net-tools=1.60_git20140218-r2 nano=2.9.8-r0 && \
wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub && \
for pkg in glibc-${GLIBC_VERSION} glibc-bin-${GLIBC_VERSION} glibc-i18n-${GLIBC_VERSION}; do curl -sSL ${GLIBC_REPO}/releases/download/${GLIBC_VERSION}/${pkg}.apk -o /tmp/${pkg}.apk; done && \
#Alex added --no-cache
apk --no-cache add /tmp/*.apk && \
rm -v /tmp/*.apk && \
( /usr/glibc-compat/bin/localedef --force --inputfile POSIX --charmap UTF-8 C.UTF-8 || true ) && \
echo "export LANG=C.UTF-8" > /etc/profile.d/locale.sh && \
/usr/glibc-compat/sbin/ldconfig /lib /usr/glibc-compat/lib && \
mkdir /opt && \
#Alex
#see https://mail-tp.fareoffice.com/java/
#COPY ${JAVA_PACKAGE}-${JAVA_VERSION_MAJOR}u${JAVA_VERSION_MINOR}-linux-x64.tar.gz /tmp/java.tar.gz
curl -sSL https://mail-tp.fareoffice.com/java/${JAVA_PACKAGE}-${JAVA_VERSION_MAJOR}u${JAVA_VERSION_MINOR}-linux-x64.tar.gz -o /tmp/java.tar.gz && \
# curl -jksSLH "Cookie: oraclelicense=accept-securebackup-cookie" -o /tmp/java.tar.gz \
# http://download.oracle.com/otn-pub/java/jdk/${JAVA_VERSION_MAJOR}u${JAVA_VERSION_MINOR}-b${JAVA_VERSION_BUILD}/${JAVA_PACKAGE}-${JAVA_VERSION_MAJOR}u${JAVA_VERSION_MINOR}-linux-x64.tar.gz && \
# JAVA_PACKAGE_SHA256=$(curl -sSL https://www.oracle.com/webfolder/s/digest/${JAVA_VERSION_MAJOR}u${JAVA_VERSION_MINOR}checksum.html | grep -E "${JAVA_PACKAGE}-${JAVA_VERSION_MAJOR}u${JAVA_VERSION_MINOR}-linux-x64\.tar\.gz" | grep -Eo '(sha256: )[^<]+' | cut -d: -f2 | xargs) && \
# echo "${JAVA_PACKAGE_SHA256} /tmp/java.tar.gz" > /tmp/java.tar.gz.sha256 && \
# sha256sum -c /tmp/java.tar.gz.sha256 && \
gunzip /tmp/java.tar.gz && \
tar -C /opt -xf /tmp/java.tar && \
ln -s /opt/jdk1.${JAVA_VERSION_MAJOR}.0_${JAVA_VERSION_MINOR} /opt/jdk && \
if [ "${JAVA_JCE}" == "unlimited" ]; then echo "Installing Unlimited JCE policy" >&2 && \
curl -jksSLH "Cookie: oraclelicense=accept-securebackup-cookie" -o /tmp/jce_policy-${JAVA_VERSION_MAJOR}.zip \
http://download.oracle.com/otn-pub/java/jce/${JAVA_VERSION_MAJOR}/jce_policy-${JAVA_VERSION_MAJOR}.zip && \
cd /tmp && unzip /tmp/jce_policy-${JAVA_VERSION_MAJOR}.zip && \
cp -v /tmp/UnlimitedJCEPolicyJDK8/*.jar /opt/jdk/jre/lib/security; \
fi && \
sed -i s/#networkaddress.cache.ttl=-1/networkaddress.cache.ttl=10/ $JAVA_HOME/jre/lib/security/java.security && \
#--Alex Git added
apk --no-cache add git=2.18.1-r0 less=530-r0 openssh=7.7_p1-r4 && \
#--Alex apk del curl glibc-i18n && \
apk del glibc-i18n && \
rm -rf /opt/jdk/*src.zip \
/opt/jdk/lib/missioncontrol \
/opt/jdk/lib/visualvm \
/opt/jdk/lib/*javafx* \
/opt/jdk/jre/plugin \
/opt/jdk/jre/bin/javaws \
/opt/jdk/jre/bin/jjs \
/opt/jdk/jre/bin/orbd \
/opt/jdk/jre/bin/pack200 \
/opt/jdk/jre/bin/policytool \
/opt/jdk/jre/bin/rmid \
/opt/jdk/jre/bin/rmiregistry \
/opt/jdk/jre/bin/servertool \
/opt/jdk/jre/bin/tnameserv \
/opt/jdk/jre/bin/unpack200 \
/opt/jdk/jre/lib/javaws.jar \
/opt/jdk/jre/lib/deploy* \
/opt/jdk/jre/lib/desktop \
/opt/jdk/jre/lib/*javafx* \
/opt/jdk/jre/lib/*jfx* \
/opt/jdk/jre/lib/amd64/libdecora_sse.so \
/opt/jdk/jre/lib/amd64/libprism_*.so \
/opt/jdk/jre/lib/amd64/libfxplugins.so \
/opt/jdk/jre/lib/amd64/libglass.so \
/opt/jdk/jre/lib/amd64/libgstreamer-lite.so \
/opt/jdk/jre/lib/amd64/libjavafx*.so \
/opt/jdk/jre/lib/amd64/libjfx*.so \
/opt/jdk/jre/lib/ext/jfxrt.jar \
/opt/jdk/jre/lib/ext/nashorn.jar \
/opt/jdk/jre/lib/oblique-fonts \
/opt/jdk/jre/lib/plugin.jar \
/tmp/* /var/cache/apk/* && \
echo 'hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4' >> /etc/nsswitch.conf
#Alex
#disable coloring for nano, see https://stackoverflow.com/a/55597765/1137529
RUN echo "syntax \"disabled\" \".\"" > ~/.nanorc; echo "color green \"^$\"" >> ~/.nanorc
#work-arround for nano
#Odd caret/cursor behavior in nano within SSH session,
#see https://github.com/Microsoft/WSL/issues/1436#issuecomment-480570997
ENV TERM eterm-color
CMD ["/bin/sh"]
#docker build --squash . -t first_base_alpine_oracle_jdk_8
#docker run -d first_base_alpine_oracle_jdk_8 bash
#based on https://blog.developer.atlassian.com/minimal-java-docker-containers/
#docker export $(docker ps -q -n=1) | docker import - prebase_alpine_oracle_jdk_8
#docker run -d prebase_alpine_oracle_jdk_8 bash
#based on https://docs.docker.com/engine/reference/commandline/commit/
#populate from docker inspect -f "{{ .Config.Env }}" first_base_alpine_oracle_jdk_8
# docker commit --change "ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/jdk/bin \
# JAVA_VERSION_MAJOR=8 \
# JAVA_VERSION_MINOR=111 \
# JAVA_VERSION_BUILD=14 \
# JAVA_PACKAGE=jdk \
# JAVA_JCE=unlimited \
# JAVA_HOME=/opt/jdk" \
# $(docker ps -q -n=1) alexberkovich/alpine-oralce-jdk8
#smoke test
#docker run -it alexberkovich/alpine-oralce-jdk8 java -version
#docker tag alexberkovich/alpine-oralce-jdk8 alexberkovich/alpine-oralce-jdk8:0.0.1
#docker push alexberkovich/alpine-oralce-jdk8
# EOF