Skip to content

Commit 3eb0351

Browse files
committed
Move 8 and 11 to consume from https://adoptopenjdk.net/upstream.html
> These binaries are built by Red Hat on behalf of the OpenJDK jdk8u and jdk11u projects. The binaries are created from the unmodified source code at OpenJDK. So to put that another way and be explicitly clear, the builds from https://adoptopenjdk.net/upstream.html are *not* AdoptOpenJDK, but are merely hosted/enabled by the AdoptOpenJDK project as explicitly vanilla builds of the upstream OpenJDK project blessed/supported by the 8u/11u project lead. For context, see #320 (comment): > I am the OpenJDK 8 and 11 Updates OpenJDK project lead. Concrete (potentially breaking) changes that are a consequence of this: 1. no more OpenJDK 7 images (see #320 (comment) -- "7 is still alive but only receives security updates" and "compatibility between 7 and 8 seems to be good enough in most cases") 2. no more OpenJDK 11 JRE images (see #320 (comment) -- "JDK 11 has no official JRE build. The reason for this is that the `jlink` tool allows users to create precisely-targeted stripped JDK images for their applications, and this is IMO better for Docker than a JRE image.") 3. the way OpenJDK is installed in 8 and 11 images is now quite different, and there will be some breakage expected -- I've tried to minimize that as much as possible, but there's only so much I can do here 4. no more OpenJDK 8 Alpine images (Alpine/musl is not officially supported by the OpenJDK project, so this reflects that -- see "Project Portola" for the Alpine porting efforts which I understand are still in need of help) 5. supported architectures are now decreased to match what's "officially" published -- for 8, we drop to just amd64, for 11 we drop to amd64 and arm64v8
1 parent 4b9abf8 commit 3eb0351

File tree

32 files changed

+976
-1488
lines changed

32 files changed

+976
-1488
lines changed

.appveyor.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ environment:
77
variant: windowsservercore-ltsc2016
88
- version: 12
99
variant: windowsservercore-ltsc2016
10+
- version: 11
11+
variant: windowsservercore-ltsc2016
12+
- version: 8
13+
variant: windowsservercore-ltsc2016
1014
- version: 8
1115
variant: windowsservercore-ltsc2016
1216

.travis.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,19 @@ matrix:
1919
env: VERSION=11
2020
- os: linux
2121
env: VERSION=11 VARIANT=slim
22+
- os: windows
23+
dist: 1803-containers
24+
env: VERSION=11 VARIANT=windows/windowsservercore-1803
2225
- os: linux
2326
env: VERSION=8
2427
- os: linux
2528
env: VERSION=8 VARIANT=slim
26-
- os: linux
27-
env: VERSION=8 VARIANT=alpine
2829
- os: windows
2930
dist: 1803-containers
3031
env: VERSION=8 VARIANT=windows/windowsservercore-1803
31-
- os: linux
32-
env: VERSION=7
33-
- os: linux
34-
env: VERSION=7 VARIANT=slim
35-
- os: linux
36-
env: VERSION=7 VARIANT=alpine
32+
- os: windows
33+
dist: 1803-containers
34+
env: VERSION=8 VARIANT=windows/windowsservercore-1803
3735

3836
install:
3937
- git clone https://github.com/docker-library/official-images.git ~/official-images

11/jdk/Dockerfile

Lines changed: 35 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,56 @@
1-
#
2-
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
3-
#
4-
# PLEASE DO NOT EDIT IT DIRECTLY.
5-
#
6-
71
FROM buildpack-deps:stretch-scm
82

9-
# A few reasons for installing distribution-provided OpenJDK:
10-
#
11-
# 1. Oracle. Licensing prevents us from redistributing the official JDK.
12-
#
13-
# 2. Compiling OpenJDK also requires the JDK to be installed, and it gets
14-
# really hairy.
15-
#
16-
# For some sample build times, see Debian's buildd logs:
17-
# https://buildd.debian.org/status/logs.php?pkg=openjdk-11
18-
19-
RUN apt-get update && apt-get install -y --no-install-recommends \
3+
RUN set -eux; \
4+
apt-get update; \
5+
apt-get install -y --no-install-recommends \
206
bzip2 \
217
unzip \
228
xz-utils \
23-
&& rm -rf /var/lib/apt/lists/*
24-
25-
RUN echo 'deb http://deb.debian.org/debian stretch-backports main' > /etc/apt/sources.list.d/stretch-backports.list
9+
; \
10+
rm -rf /var/lib/apt/lists/*
2611

2712
# Default to UTF-8 file.encoding
2813
ENV LANG C.UTF-8
2914

30-
# add a simple script that can auto-detect the appropriate JAVA_HOME value
31-
# based on whether the JDK or only the JRE is installed
32-
RUN { \
33-
echo '#!/bin/sh'; \
34-
echo 'set -e'; \
35-
echo; \
36-
echo 'dirname "$(dirname "$(readlink -f "$(which javac || which java)")")"'; \
37-
} > /usr/local/bin/docker-java-home \
38-
&& chmod +x /usr/local/bin/docker-java-home
15+
ENV JAVA_HOME /usr/local/openjdk-11
16+
ENV PATH $JAVA_HOME/bin:$PATH
3917

40-
# do some fancy footwork to create a JAVA_HOME that's cross-architecture-safe
41-
RUN ln -svT "/usr/lib/jvm/java-11-openjdk-$(dpkg --print-architecture)" /docker-java-home
42-
ENV JAVA_HOME /docker-java-home
18+
# backwards compatibility shim
19+
RUN { echo '#/bin/sh'; echo 'echo "$JAVA_HOME"'; } > /usr/local/bin/docker-java-home && chmod +x /usr/local/bin/docker-java-home && [ "$JAVA_HOME" = "$(docker-java-home)" ]
4320

21+
# https://adoptopenjdk.net/upstream.html
4422
ENV JAVA_VERSION 11.0.3
45-
ENV JAVA_DEBIAN_VERSION 11.0.3+1-1~bpo9+2
23+
ENV JAVA_BASE_URL https://github.com/AdoptOpenJDK/openjdk11-upstream-binaries/releases/download/jdk-11.0.3%2B7/OpenJDK11U-
24+
ENV JAVA_URL_VERSION 11.0.3_7
25+
# https://github.com/docker-library/openjdk/issues/320#issuecomment-494050246
4626

47-
RUN set -ex; \
27+
RUN set -eux; \
4828
\
49-
# deal with slim variants not having man page directories (which causes "update-alternatives" to fail)
50-
if [ ! -d /usr/share/man/man1 ]; then \
51-
mkdir -p /usr/share/man/man1; \
52-
fi; \
29+
dpkgArch="$(dpkg --print-architecture)"; \
30+
case "$dpkgArch" in \
31+
amd64) upstreamArch='x64' ;; \
32+
arm64) upstreamArch='aarch64' ;; \
33+
*) echo >&2 "error: unsupported architecture: $dpkgArch" ;; \
34+
esac; \
5335
\
54-
# ca-certificates-java does not work on src:openjdk-11 with no-install-recommends: (https://bugs.debian.org/914860, https://bugs.debian.org/775775)
55-
# /var/lib/dpkg/info/ca-certificates-java.postinst: line 56: java: command not found
56-
ln -svT /docker-java-home/bin/java /usr/local/bin/java; \
36+
wget -O openjdk.tgz.asc "${JAVA_BASE_URL}${upstreamArch}_linux_${JAVA_URL_VERSION}.tar.gz.sign"; \
37+
wget -O openjdk.tgz "${JAVA_BASE_URL}${upstreamArch}_linux_${JAVA_URL_VERSION}.tar.gz" --progress=dot:giga; \
5738
\
58-
apt-get update; \
59-
apt-get install -y --no-install-recommends \
60-
openjdk-11-jdk="$JAVA_DEBIAN_VERSION" \
61-
; \
62-
rm -rf /var/lib/apt/lists/*; \
39+
export GNUPGHOME="$(mktemp -d)"; \
40+
# TODO find a good link for users to verify this key is right (https://mail.openjdk.java.net/pipermail/jdk-updates-dev/2019-April/000951.html is one of the only mentions of it I can find); perhaps a note added to https://adoptopenjdk.net/upstream.html would make sense?
41+
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys CA5F11C6CE22644D42C6AC4492EF8D39DC13168F; \
42+
gpg --batch --verify openjdk.tgz.asc openjdk.tgz; \
43+
rm -rf "$GNUPGHOME"; \
6344
\
64-
rm -v /usr/local/bin/java; \
45+
mkdir -p "$JAVA_HOME"; \
46+
tar --extract --file openjdk.tgz --directory "$JAVA_HOME" --strip-components 1; \
47+
rm openjdk.tgz*; \
6548
\
66-
# ca-certificates-java does not work on src:openjdk-11: (https://bugs.debian.org/914424, https://bugs.debian.org/894979, https://salsa.debian.org/java-team/ca-certificates-java/commit/813b8c4973e6c4bb273d5d02f8d4e0aa0b226c50#d4b95d176f05e34cd0b718357c532dc5a6d66cd7_54_56)
67-
keytool -importkeystore -srckeystore /etc/ssl/certs/java/cacerts -destkeystore /etc/ssl/certs/java/cacerts.jks -deststoretype JKS -srcstorepass changeit -deststorepass changeit -noprompt; \
68-
mv /etc/ssl/certs/java/cacerts.jks /etc/ssl/certs/java/cacerts; \
69-
/var/lib/dpkg/info/ca-certificates-java.postinst configure; \
49+
# TODO strip "demo" and "man" folders?
7050
\
71-
# verify that "docker-java-home" returns what we expect
72-
[ "$(readlink -f "$JAVA_HOME")" = "$(docker-java-home)" ]; \
73-
\
74-
# update-alternatives so that future installs of other OpenJDK versions don't change /usr/bin/java
75-
update-alternatives --get-selections | awk -v home="$(readlink -f "$JAVA_HOME")" 'index($3, home) == 1 { $2 = "manual"; print | "update-alternatives --set-selections" }'; \
76-
# ... and verify that it actually worked for one of the alternatives we care about
77-
update-alternatives --query java | grep -q 'Status: manual'
51+
# basic smoke test
52+
javac --version; \
53+
java --version
7854

79-
# https://docs.oracle.com/javase/10/tools/jshell.htm
80-
# https://en.wikipedia.org/wiki/JShell
55+
# "jshell" is an interactive REPL for Java (see https://en.wikipedia.org/wiki/JShell)
8156
CMD ["jshell"]
82-
83-
# If you're reading this and have any feedback on how this image could be
84-
# improved, please open an issue or a pull request so we can discuss it!
85-
#
86-
# https://github.com/docker-library/openjdk/issues

11/jdk/slim/Dockerfile

Lines changed: 39 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,60 @@
1-
#
2-
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
3-
#
4-
# PLEASE DO NOT EDIT IT DIRECTLY.
5-
#
6-
71
FROM debian:stretch-slim
82

9-
# A few reasons for installing distribution-provided OpenJDK:
10-
#
11-
# 1. Oracle. Licensing prevents us from redistributing the official JDK.
12-
#
13-
# 2. Compiling OpenJDK also requires the JDK to be installed, and it gets
14-
# really hairy.
15-
#
16-
# For some sample build times, see Debian's buildd logs:
17-
# https://buildd.debian.org/status/logs.php?pkg=openjdk-11
18-
19-
RUN apt-get update && apt-get install -y --no-install-recommends \
20-
bzip2 \
21-
unzip \
22-
xz-utils \
23-
&& rm -rf /var/lib/apt/lists/*
24-
25-
RUN echo 'deb http://deb.debian.org/debian stretch-backports main' > /etc/apt/sources.list.d/stretch-backports.list
26-
273
# Default to UTF-8 file.encoding
284
ENV LANG C.UTF-8
295

30-
# add a simple script that can auto-detect the appropriate JAVA_HOME value
31-
# based on whether the JDK or only the JRE is installed
32-
RUN { \
33-
echo '#!/bin/sh'; \
34-
echo 'set -e'; \
35-
echo; \
36-
echo 'dirname "$(dirname "$(readlink -f "$(which javac || which java)")")"'; \
37-
} > /usr/local/bin/docker-java-home \
38-
&& chmod +x /usr/local/bin/docker-java-home
6+
ENV JAVA_HOME /usr/local/openjdk-11
7+
ENV PATH $JAVA_HOME/bin:$PATH
398

40-
# do some fancy footwork to create a JAVA_HOME that's cross-architecture-safe
41-
RUN ln -svT "/usr/lib/jvm/java-11-openjdk-$(dpkg --print-architecture)" /docker-java-home
42-
ENV JAVA_HOME /docker-java-home
9+
# backwards compatibility shim
10+
RUN { echo '#/bin/sh'; echo 'echo "$JAVA_HOME"'; } > /usr/local/bin/docker-java-home && chmod +x /usr/local/bin/docker-java-home && [ "$JAVA_HOME" = "$(docker-java-home)" ]
4311

12+
# https://adoptopenjdk.net/upstream.html
4413
ENV JAVA_VERSION 11.0.3
45-
ENV JAVA_DEBIAN_VERSION 11.0.3+1-1~bpo9+2
14+
ENV JAVA_BASE_URL https://github.com/AdoptOpenJDK/openjdk11-upstream-binaries/releases/download/jdk-11.0.3%2B7/OpenJDK11U-
15+
ENV JAVA_URL_VERSION 11.0.3_7
16+
# https://github.com/docker-library/openjdk/issues/320#issuecomment-494050246
4617

47-
RUN set -ex; \
18+
RUN set -eux; \
4819
\
49-
# deal with slim variants not having man page directories (which causes "update-alternatives" to fail)
50-
if [ ! -d /usr/share/man/man1 ]; then \
51-
mkdir -p /usr/share/man/man1; \
52-
fi; \
53-
\
54-
# ca-certificates-java does not work on src:openjdk-11 with no-install-recommends: (https://bugs.debian.org/914860, https://bugs.debian.org/775775)
55-
# /var/lib/dpkg/info/ca-certificates-java.postinst: line 56: java: command not found
56-
ln -svT /docker-java-home/bin/java /usr/local/bin/java; \
20+
dpkgArch="$(dpkg --print-architecture)"; \
21+
case "$dpkgArch" in \
22+
amd64) upstreamArch='x64' ;; \
23+
# TODO filter out arm64 for openjdk:8 (https://github.com/AdoptOpenJDK/openjdk8-upstream-binaries/releases/tag/jdk8u212-b04 vs https://github.com/AdoptOpenJDK/openjdk11-upstream-binaries/releases/tag/jdk-11.0.3%2B7)
24+
arm64) upstreamArch='aarch64' ;; \
25+
*) echo >&2 "error: unsupported architecture: $dpkgArch" ;; \
26+
esac; \
5727
\
28+
savedAptMark="$(apt-mark showmanual)"; \
5829
apt-get update; \
5930
apt-get install -y --no-install-recommends \
60-
openjdk-11-jdk-headless="$JAVA_DEBIAN_VERSION" \
31+
ca-certificates wget \
32+
gnupg dirmngr \
6133
; \
6234
rm -rf /var/lib/apt/lists/*; \
6335
\
64-
rm -v /usr/local/bin/java; \
36+
wget -O openjdk.tgz.asc "${JAVA_BASE_URL}${upstreamArch}_linux_${JAVA_URL_VERSION}.tar.gz.sign"; \
37+
wget -O openjdk.tgz "${JAVA_BASE_URL}${upstreamArch}_linux_${JAVA_URL_VERSION}.tar.gz" --progress=dot:giga; \
38+
\
39+
export GNUPGHOME="$(mktemp -d)"; \
40+
# TODO find a good link for users to verify this key is right (https://mail.openjdk.java.net/pipermail/jdk-updates-dev/2019-April/000951.html is one of the only mentions of it I can find); perhaps a note added to https://adoptopenjdk.net/upstream.html would make sense?
41+
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys CA5F11C6CE22644D42C6AC4492EF8D39DC13168F; \
42+
gpg --batch --verify openjdk.tgz.asc openjdk.tgz; \
43+
rm -rf "$GNUPGHOME"; \
6544
\
66-
# ca-certificates-java does not work on src:openjdk-11: (https://bugs.debian.org/914424, https://bugs.debian.org/894979, https://salsa.debian.org/java-team/ca-certificates-java/commit/813b8c4973e6c4bb273d5d02f8d4e0aa0b226c50#d4b95d176f05e34cd0b718357c532dc5a6d66cd7_54_56)
67-
keytool -importkeystore -srckeystore /etc/ssl/certs/java/cacerts -destkeystore /etc/ssl/certs/java/cacerts.jks -deststoretype JKS -srcstorepass changeit -deststorepass changeit -noprompt; \
68-
mv /etc/ssl/certs/java/cacerts.jks /etc/ssl/certs/java/cacerts; \
69-
/var/lib/dpkg/info/ca-certificates-java.postinst configure; \
45+
mkdir -p "$JAVA_HOME"; \
46+
tar --extract --file openjdk.tgz --directory "$JAVA_HOME" --strip-components 1; \
47+
rm openjdk.tgz*; \
7048
\
71-
# verify that "docker-java-home" returns what we expect
72-
[ "$(readlink -f "$JAVA_HOME")" = "$(docker-java-home)" ]; \
49+
# TODO strip "demo" and "man" folders?
7350
\
74-
# update-alternatives so that future installs of other OpenJDK versions don't change /usr/bin/java
75-
update-alternatives --get-selections | awk -v home="$(readlink -f "$JAVA_HOME")" 'index($3, home) == 1 { $2 = "manual"; print | "update-alternatives --set-selections" }'; \
76-
# ... and verify that it actually worked for one of the alternatives we care about
77-
update-alternatives --query java | grep -q 'Status: manual'
51+
apt-mark auto '.*' > /dev/null; \
52+
[ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \
53+
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
54+
\
55+
# basic smoke test
56+
javac --version; \
57+
java --version
7858

79-
# https://docs.oracle.com/javase/10/tools/jshell.htm
80-
# https://en.wikipedia.org/wiki/JShell
59+
# "jshell" is an interactive REPL for Java (see https://en.wikipedia.org/wiki/JShell)
8160
CMD ["jshell"]
82-
83-
# If you're reading this and have any feedback on how this image could be
84-
# improved, please open an issue or a pull request so we can discuss it!
85-
#
86-
# https://github.com/docker-library/openjdk/issues
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
FROM mcr.microsoft.com/windows/servercore:1803
2+
3+
# $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324
4+
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
5+
6+
# enable TLS 1.2 (Nano Server doesn't support using "[Net.ServicePointManager]::SecurityProtocol")
7+
# https://docs.microsoft.com/en-us/system-center/vmm/install-tls?view=sc-vmm-1801
8+
# https://docs.microsoft.com/en-us/windows-server/identity/ad-fs/operations/manage-ssl-protocols-in-ad-fs#enable-tls-12
9+
RUN Write-Host 'Enabling TLS 1.2 (https://githubengineering.com/crypto-removal-notice/) ...'; \
10+
$tls12RegBase = 'HKLM:\\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2'; \
11+
if (Test-Path $tls12RegBase) { throw ('"{0}" already exists!' -f $tls12RegBase) }; \
12+
New-Item -Path ('{0}/Client' -f $tls12RegBase) -Force; \
13+
New-Item -Path ('{0}/Server' -f $tls12RegBase) -Force; \
14+
New-ItemProperty -Path ('{0}/Client' -f $tls12RegBase) -Name 'DisabledByDefault' -PropertyType DWORD -Value 0 -Force; \
15+
New-ItemProperty -Path ('{0}/Client' -f $tls12RegBase) -Name 'Enabled' -PropertyType DWORD -Value 1 -Force; \
16+
New-ItemProperty -Path ('{0}/Server' -f $tls12RegBase) -Name 'DisabledByDefault' -PropertyType DWORD -Value 0 -Force; \
17+
New-ItemProperty -Path ('{0}/Server' -f $tls12RegBase) -Name 'Enabled' -PropertyType DWORD -Value 1 -Force
18+
19+
ENV JAVA_HOME C:\\openjdk-11
20+
RUN $newPath = ('{0}\bin;{1}' -f $env:JAVA_HOME, $env:PATH); \
21+
Write-Host ('Updating PATH: {0}' -f $newPath); \
22+
# Nano Server does not have "[Environment]::SetEnvironmentVariable()"
23+
setx /M PATH $newPath
24+
25+
# https://adoptopenjdk.net/upstream.html
26+
ENV JAVA_VERSION 11.0.3
27+
ENV JAVA_BASE_URL https://github.com/AdoptOpenJDK/openjdk11-upstream-binaries/releases/download/jdk-11.0.3%2B7/OpenJDK11U-
28+
ENV JAVA_URL_VERSION 11.0.3_7
29+
# https://github.com/docker-library/openjdk/issues/320#issuecomment-494050246
30+
31+
RUN $url = ('{0}x64_windows_{1}.zip' -f $env:JAVA_BASE_URL, $env:JAVA_URL_VERSION); \
32+
Write-Host ('Downloading {0} ...' -f $url); \
33+
Invoke-WebRequest -Uri $url -OutFile 'openjdk.zip'; \
34+
# TODO signature? checksum?
35+
\
36+
Write-Host 'Expanding ...'; \
37+
New-Item -ItemType Directory -Path C:\temp | Out-Null; \
38+
Expand-Archive openjdk.zip -DestinationPath C:\temp; \
39+
Move-Item -Path C:\temp\* -Destination $env:JAVA_HOME; \
40+
Remove-Item C:\temp; \
41+
\
42+
Write-Host 'Removing ...'; \
43+
Remove-Item openjdk.zip -Force; \
44+
\
45+
Write-Host 'Verifying install ...'; \
46+
Write-Host ' javac --version'; javac --version; \
47+
Write-Host ' java --version'; java --version; \
48+
\
49+
Write-Host 'Complete.'
50+
51+
# "jshell" is an interactive REPL for Java (see https://en.wikipedia.org/wiki/JShell)
52+
CMD ["jshell"]
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
FROM mcr.microsoft.com/windows/servercore:1809
2+
3+
# $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324
4+
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
5+
6+
# enable TLS 1.2 (Nano Server doesn't support using "[Net.ServicePointManager]::SecurityProtocol")
7+
# https://docs.microsoft.com/en-us/system-center/vmm/install-tls?view=sc-vmm-1801
8+
# https://docs.microsoft.com/en-us/windows-server/identity/ad-fs/operations/manage-ssl-protocols-in-ad-fs#enable-tls-12
9+
RUN Write-Host 'Enabling TLS 1.2 (https://githubengineering.com/crypto-removal-notice/) ...'; \
10+
$tls12RegBase = 'HKLM:\\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2'; \
11+
if (Test-Path $tls12RegBase) { throw ('"{0}" already exists!' -f $tls12RegBase) }; \
12+
New-Item -Path ('{0}/Client' -f $tls12RegBase) -Force; \
13+
New-Item -Path ('{0}/Server' -f $tls12RegBase) -Force; \
14+
New-ItemProperty -Path ('{0}/Client' -f $tls12RegBase) -Name 'DisabledByDefault' -PropertyType DWORD -Value 0 -Force; \
15+
New-ItemProperty -Path ('{0}/Client' -f $tls12RegBase) -Name 'Enabled' -PropertyType DWORD -Value 1 -Force; \
16+
New-ItemProperty -Path ('{0}/Server' -f $tls12RegBase) -Name 'DisabledByDefault' -PropertyType DWORD -Value 0 -Force; \
17+
New-ItemProperty -Path ('{0}/Server' -f $tls12RegBase) -Name 'Enabled' -PropertyType DWORD -Value 1 -Force
18+
19+
ENV JAVA_HOME C:\\openjdk-11
20+
RUN $newPath = ('{0}\bin;{1}' -f $env:JAVA_HOME, $env:PATH); \
21+
Write-Host ('Updating PATH: {0}' -f $newPath); \
22+
# Nano Server does not have "[Environment]::SetEnvironmentVariable()"
23+
setx /M PATH $newPath
24+
25+
# https://adoptopenjdk.net/upstream.html
26+
ENV JAVA_VERSION 11.0.3
27+
ENV JAVA_BASE_URL https://github.com/AdoptOpenJDK/openjdk11-upstream-binaries/releases/download/jdk-11.0.3%2B7/OpenJDK11U-
28+
ENV JAVA_URL_VERSION 11.0.3_7
29+
# https://github.com/docker-library/openjdk/issues/320#issuecomment-494050246
30+
31+
RUN $url = ('{0}x64_windows_{1}.zip' -f $env:JAVA_BASE_URL, $env:JAVA_URL_VERSION); \
32+
Write-Host ('Downloading {0} ...' -f $url); \
33+
Invoke-WebRequest -Uri $url -OutFile 'openjdk.zip'; \
34+
# TODO signature? checksum?
35+
\
36+
Write-Host 'Expanding ...'; \
37+
New-Item -ItemType Directory -Path C:\temp | Out-Null; \
38+
Expand-Archive openjdk.zip -DestinationPath C:\temp; \
39+
Move-Item -Path C:\temp\* -Destination $env:JAVA_HOME; \
40+
Remove-Item C:\temp; \
41+
\
42+
Write-Host 'Removing ...'; \
43+
Remove-Item openjdk.zip -Force; \
44+
\
45+
Write-Host 'Verifying install ...'; \
46+
Write-Host ' javac --version'; javac --version; \
47+
Write-Host ' java --version'; java --version; \
48+
\
49+
Write-Host 'Complete.'
50+
51+
# "jshell" is an interactive REPL for Java (see https://en.wikipedia.org/wiki/JShell)
52+
CMD ["jshell"]

0 commit comments

Comments
 (0)