Skip to content

Commit b7a33e6

Browse files
committed
Merge pull request #61 from infosiftr/java-home
Add explicit JAVA_HOME environment variable
2 parents e2f1ab4 + 5552e0c commit b7a33e6

File tree

9 files changed

+307
-44
lines changed

9 files changed

+307
-44
lines changed

openjdk-6-jdk/Dockerfile

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
#
2+
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
3+
#
4+
# PLEASE DO NOT EDIT IT DIRECTLY.
5+
#
6+
17
FROM buildpack-deps:wheezy-scm
28

39
# A few problems with compiling Java from source:
@@ -10,10 +16,27 @@ RUN apt-get update && apt-get install -y unzip && rm -rf /var/lib/apt/lists/*
1016
# Default to UTF-8 file.encoding
1117
ENV LANG C.UTF-8
1218

19+
# add a simple script that can auto-detect the appropriate JAVA_HOME value
20+
# based on whether the JDK or only the JRE is installed
21+
RUN { \
22+
echo '#!/bin/bash'; \
23+
echo 'set -e'; \
24+
echo; \
25+
echo 'dirname "$(dirname "$(readlink -f "$(which javac || which java)")")"'; \
26+
} > /usr/local/bin/docker-java-home \
27+
&& chmod +x /usr/local/bin/docker-java-home
28+
29+
ENV JAVA_HOME /usr/lib/jvm/java-6-openjdk-amd64
30+
1331
ENV JAVA_VERSION 6b36
1432
ENV JAVA_DEBIAN_VERSION 6b36-1.13.8-1~deb7u1
1533

16-
RUN apt-get update && apt-get install -y openjdk-6-jdk="$JAVA_DEBIAN_VERSION" && rm -rf /var/lib/apt/lists/*
34+
RUN set -x \
35+
&& apt-get update \
36+
&& apt-get install -y \
37+
openjdk-6-jdk="$JAVA_DEBIAN_VERSION" \
38+
&& rm -rf /var/lib/apt/lists/* \
39+
&& [ "$JAVA_HOME" = "$(docker-java-home)" ]
1740

1841
# If you're reading this and have any feedback on how this image could be
1942
# improved, please open an issue or a pull request so we can discuss it!

openjdk-6-jre/Dockerfile

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
#
2+
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
3+
#
4+
# PLEASE DO NOT EDIT IT DIRECTLY.
5+
#
6+
17
FROM buildpack-deps:wheezy-curl
28

39
# A few problems with compiling Java from source:
@@ -10,10 +16,27 @@ RUN apt-get update && apt-get install -y unzip && rm -rf /var/lib/apt/lists/*
1016
# Default to UTF-8 file.encoding
1117
ENV LANG C.UTF-8
1218

19+
# add a simple script that can auto-detect the appropriate JAVA_HOME value
20+
# based on whether the JDK or only the JRE is installed
21+
RUN { \
22+
echo '#!/bin/bash'; \
23+
echo 'set -e'; \
24+
echo; \
25+
echo 'dirname "$(dirname "$(readlink -f "$(which javac || which java)")")"'; \
26+
} > /usr/local/bin/docker-java-home \
27+
&& chmod +x /usr/local/bin/docker-java-home
28+
29+
ENV JAVA_HOME /usr/lib/jvm/java-6-openjdk-amd64/jre
30+
1331
ENV JAVA_VERSION 6b36
1432
ENV JAVA_DEBIAN_VERSION 6b36-1.13.8-1~deb7u1
1533

16-
RUN apt-get update && apt-get install -y openjdk-6-jre-headless="$JAVA_DEBIAN_VERSION" && rm -rf /var/lib/apt/lists/*
34+
RUN set -x \
35+
&& apt-get update \
36+
&& apt-get install -y \
37+
openjdk-6-jre-headless="$JAVA_DEBIAN_VERSION" \
38+
&& rm -rf /var/lib/apt/lists/* \
39+
&& [ "$JAVA_HOME" = "$(docker-java-home)" ]
1740

1841
# If you're reading this and have any feedback on how this image could be
1942
# improved, please open an issue or a pull request so we can discuss it!

openjdk-7-jdk/Dockerfile

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
#
2+
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
3+
#
4+
# PLEASE DO NOT EDIT IT DIRECTLY.
5+
#
6+
17
FROM buildpack-deps:jessie-scm
28

39
# A few problems with compiling Java from source:
@@ -10,10 +16,27 @@ RUN apt-get update && apt-get install -y unzip && rm -rf /var/lib/apt/lists/*
1016
# Default to UTF-8 file.encoding
1117
ENV LANG C.UTF-8
1218

19+
# add a simple script that can auto-detect the appropriate JAVA_HOME value
20+
# based on whether the JDK or only the JRE is installed
21+
RUN { \
22+
echo '#!/bin/bash'; \
23+
echo 'set -e'; \
24+
echo; \
25+
echo 'dirname "$(dirname "$(readlink -f "$(which javac || which java)")")"'; \
26+
} > /usr/local/bin/docker-java-home \
27+
&& chmod +x /usr/local/bin/docker-java-home
28+
29+
ENV JAVA_HOME /usr/lib/jvm/java-7-openjdk-amd64
30+
1331
ENV JAVA_VERSION 7u91
1432
ENV JAVA_DEBIAN_VERSION 7u91-2.6.3-1~deb8u1
1533

16-
RUN apt-get update && apt-get install -y openjdk-7-jdk="$JAVA_DEBIAN_VERSION" && rm -rf /var/lib/apt/lists/*
34+
RUN set -x \
35+
&& apt-get update \
36+
&& apt-get install -y \
37+
openjdk-7-jdk="$JAVA_DEBIAN_VERSION" \
38+
&& rm -rf /var/lib/apt/lists/* \
39+
&& [ "$JAVA_HOME" = "$(docker-java-home)" ]
1740

1841
# If you're reading this and have any feedback on how this image could be
1942
# improved, please open an issue or a pull request so we can discuss it!

openjdk-7-jre/Dockerfile

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
#
2+
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
3+
#
4+
# PLEASE DO NOT EDIT IT DIRECTLY.
5+
#
6+
17
FROM buildpack-deps:jessie-curl
28

39
# A few problems with compiling Java from source:
@@ -10,10 +16,27 @@ RUN apt-get update && apt-get install -y unzip && rm -rf /var/lib/apt/lists/*
1016
# Default to UTF-8 file.encoding
1117
ENV LANG C.UTF-8
1218

19+
# add a simple script that can auto-detect the appropriate JAVA_HOME value
20+
# based on whether the JDK or only the JRE is installed
21+
RUN { \
22+
echo '#!/bin/bash'; \
23+
echo 'set -e'; \
24+
echo; \
25+
echo 'dirname "$(dirname "$(readlink -f "$(which javac || which java)")")"'; \
26+
} > /usr/local/bin/docker-java-home \
27+
&& chmod +x /usr/local/bin/docker-java-home
28+
29+
ENV JAVA_HOME /usr/lib/jvm/java-7-openjdk-amd64/jre
30+
1331
ENV JAVA_VERSION 7u91
1432
ENV JAVA_DEBIAN_VERSION 7u91-2.6.3-1~deb8u1
1533

16-
RUN apt-get update && apt-get install -y openjdk-7-jre-headless="$JAVA_DEBIAN_VERSION" && rm -rf /var/lib/apt/lists/*
34+
RUN set -x \
35+
&& apt-get update \
36+
&& apt-get install -y \
37+
openjdk-7-jre-headless="$JAVA_DEBIAN_VERSION" \
38+
&& rm -rf /var/lib/apt/lists/* \
39+
&& [ "$JAVA_HOME" = "$(docker-java-home)" ]
1740

1841
# If you're reading this and have any feedback on how this image could be
1942
# improved, please open an issue or a pull request so we can discuss it!

openjdk-8-jdk/Dockerfile

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
#
2+
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
3+
#
4+
# PLEASE DO NOT EDIT IT DIRECTLY.
5+
#
6+
17
FROM buildpack-deps:jessie-scm
28

39
# A few problems with compiling Java from source:
@@ -12,6 +18,18 @@ RUN echo 'deb http://httpredir.debian.org/debian jessie-backports main' > /etc/a
1218
# Default to UTF-8 file.encoding
1319
ENV LANG C.UTF-8
1420

21+
# add a simple script that can auto-detect the appropriate JAVA_HOME value
22+
# based on whether the JDK or only the JRE is installed
23+
RUN { \
24+
echo '#!/bin/bash'; \
25+
echo 'set -e'; \
26+
echo; \
27+
echo 'dirname "$(dirname "$(readlink -f "$(which javac || which java)")")"'; \
28+
} > /usr/local/bin/docker-java-home \
29+
&& chmod +x /usr/local/bin/docker-java-home
30+
31+
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
32+
1533
ENV JAVA_VERSION 8u66
1634
ENV JAVA_DEBIAN_VERSION 8u66-b17-1~bpo8+1
1735

@@ -24,7 +42,8 @@ RUN set -x \
2442
&& apt-get install -y \
2543
openjdk-8-jdk="$JAVA_DEBIAN_VERSION" \
2644
ca-certificates-java="$CA_CERTIFICATES_JAVA_VERSION" \
27-
&& rm -rf /var/lib/apt/lists/*
45+
&& rm -rf /var/lib/apt/lists/* \
46+
&& [ "$JAVA_HOME" = "$(docker-java-home)" ]
2847

2948
# see CA_CERTIFICATES_JAVA_VERSION notes above
3049
RUN /var/lib/dpkg/info/ca-certificates-java.postinst configure

openjdk-8-jre/Dockerfile

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
#
2+
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
3+
#
4+
# PLEASE DO NOT EDIT IT DIRECTLY.
5+
#
6+
17
FROM buildpack-deps:jessie-curl
28

39
# A few problems with compiling Java from source:
@@ -12,6 +18,18 @@ RUN echo 'deb http://httpredir.debian.org/debian jessie-backports main' > /etc/a
1218
# Default to UTF-8 file.encoding
1319
ENV LANG C.UTF-8
1420

21+
# add a simple script that can auto-detect the appropriate JAVA_HOME value
22+
# based on whether the JDK or only the JRE is installed
23+
RUN { \
24+
echo '#!/bin/bash'; \
25+
echo 'set -e'; \
26+
echo; \
27+
echo 'dirname "$(dirname "$(readlink -f "$(which javac || which java)")")"'; \
28+
} > /usr/local/bin/docker-java-home \
29+
&& chmod +x /usr/local/bin/docker-java-home
30+
31+
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64/jre
32+
1533
ENV JAVA_VERSION 8u66
1634
ENV JAVA_DEBIAN_VERSION 8u66-b17-1~bpo8+1
1735

@@ -24,14 +42,11 @@ RUN set -x \
2442
&& apt-get install -y \
2543
openjdk-8-jre-headless="$JAVA_DEBIAN_VERSION" \
2644
ca-certificates-java="$CA_CERTIFICATES_JAVA_VERSION" \
27-
&& rm -rf /var/lib/apt/lists/*
45+
&& rm -rf /var/lib/apt/lists/* \
46+
&& [ "$JAVA_HOME" = "$(docker-java-home)" ]
2847

2948
# see CA_CERTIFICATES_JAVA_VERSION notes above
3049
RUN /var/lib/dpkg/info/ca-certificates-java.postinst configure
3150

32-
# see https://bugs.debian.org/793210
33-
# and https://github.com/docker-library/java/issues/46#issuecomment-119026586
34-
RUN apt-get update && apt-get install -y --no-install-recommends libfontconfig1 && rm -rf /var/lib/apt/lists/*
35-
3651
# If you're reading this and have any feedback on how this image could be
3752
# improved, please open an issue or a pull request so we can discuss it!

openjdk-9-jdk/Dockerfile

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
FROM buildpack-deps:sid-curl
1+
#
2+
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
3+
#
4+
# PLEASE DO NOT EDIT IT DIRECTLY.
5+
#
6+
7+
FROM buildpack-deps:sid-scm
28

39
# A few problems with compiling Java from source:
410
# 1. Oracle. Licensing prevents us from redistributing the official JDK.
@@ -12,6 +18,18 @@ RUN echo 'deb http://httpredir.debian.org/debian experimental main' > /etc/apt/s
1218
# Default to UTF-8 file.encoding
1319
ENV LANG C.UTF-8
1420

21+
# add a simple script that can auto-detect the appropriate JAVA_HOME value
22+
# based on whether the JDK or only the JRE is installed
23+
RUN { \
24+
echo '#!/bin/bash'; \
25+
echo 'set -e'; \
26+
echo; \
27+
echo 'dirname "$(dirname "$(readlink -f "$(which javac || which java)")")"'; \
28+
} > /usr/local/bin/docker-java-home \
29+
&& chmod +x /usr/local/bin/docker-java-home
30+
31+
ENV JAVA_HOME /usr/lib/jvm/java-9-openjdk-amd64
32+
1533
ENV JAVA_VERSION 9~b96
1634
ENV JAVA_DEBIAN_VERSION 9~b96-1
1735

@@ -24,14 +42,11 @@ RUN set -x \
2442
&& apt-get install -y \
2543
openjdk-9-jdk="$JAVA_DEBIAN_VERSION" \
2644
ca-certificates-java="$CA_CERTIFICATES_JAVA_VERSION" \
27-
&& rm -rf /var/lib/apt/lists/*
45+
&& rm -rf /var/lib/apt/lists/* \
46+
&& [ "$JAVA_HOME" = "$(docker-java-home)" ]
2847

2948
# see CA_CERTIFICATES_JAVA_VERSION notes above
3049
RUN /var/lib/dpkg/info/ca-certificates-java.postinst configure
3150

32-
# see https://bugs.debian.org/793210
33-
# and https://github.com/docker-library/java/issues/46#issuecomment-119026586
34-
RUN apt-get update && apt-get install -y --no-install-recommends libfontconfig1 && rm -rf /var/lib/apt/lists/*
35-
3651
# If you're reading this and have any feedback on how this image could be
3752
# improved, please open an issue or a pull request so we can discuss it!

openjdk-9-jre/Dockerfile

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
#
2+
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
3+
#
4+
# PLEASE DO NOT EDIT IT DIRECTLY.
5+
#
6+
17
FROM buildpack-deps:sid-curl
28

39
# A few problems with compiling Java from source:
@@ -12,6 +18,18 @@ RUN echo 'deb http://httpredir.debian.org/debian experimental main' > /etc/apt/s
1218
# Default to UTF-8 file.encoding
1319
ENV LANG C.UTF-8
1420

21+
# add a simple script that can auto-detect the appropriate JAVA_HOME value
22+
# based on whether the JDK or only the JRE is installed
23+
RUN { \
24+
echo '#!/bin/bash'; \
25+
echo 'set -e'; \
26+
echo; \
27+
echo 'dirname "$(dirname "$(readlink -f "$(which javac || which java)")")"'; \
28+
} > /usr/local/bin/docker-java-home \
29+
&& chmod +x /usr/local/bin/docker-java-home
30+
31+
ENV JAVA_HOME /usr/lib/jvm/java-9-openjdk-amd64
32+
1533
ENV JAVA_VERSION 9~b96
1634
ENV JAVA_DEBIAN_VERSION 9~b96-1
1735

@@ -24,14 +42,11 @@ RUN set -x \
2442
&& apt-get install -y \
2543
openjdk-9-jre-headless="$JAVA_DEBIAN_VERSION" \
2644
ca-certificates-java="$CA_CERTIFICATES_JAVA_VERSION" \
27-
&& rm -rf /var/lib/apt/lists/*
45+
&& rm -rf /var/lib/apt/lists/* \
46+
&& [ "$JAVA_HOME" = "$(docker-java-home)" ]
2847

2948
# see CA_CERTIFICATES_JAVA_VERSION notes above
3049
RUN /var/lib/dpkg/info/ca-certificates-java.postinst configure
3150

32-
# see https://bugs.debian.org/793210
33-
# and https://github.com/docker-library/java/issues/46#issuecomment-119026586
34-
RUN apt-get update && apt-get install -y --no-install-recommends libfontconfig1 && rm -rf /var/lib/apt/lists/*
35-
3651
# If you're reading this and have any feedback on how this image could be
3752
# improved, please open an issue or a pull request so we can discuss it!

0 commit comments

Comments
 (0)