forked from docker-library/openjdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 docker-library#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 docker-library#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 docker-library#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
- Loading branch information
Showing
32 changed files
with
976 additions
and
1,488 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,86 +1,56 @@ | ||
# | ||
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" | ||
# | ||
# PLEASE DO NOT EDIT IT DIRECTLY. | ||
# | ||
|
||
FROM buildpack-deps:stretch-scm | ||
|
||
# A few reasons for installing distribution-provided OpenJDK: | ||
# | ||
# 1. Oracle. Licensing prevents us from redistributing the official JDK. | ||
# | ||
# 2. Compiling OpenJDK also requires the JDK to be installed, and it gets | ||
# really hairy. | ||
# | ||
# For some sample build times, see Debian's buildd logs: | ||
# https://buildd.debian.org/status/logs.php?pkg=openjdk-11 | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
RUN set -eux; \ | ||
apt-get update; \ | ||
apt-get install -y --no-install-recommends \ | ||
bzip2 \ | ||
unzip \ | ||
xz-utils \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN echo 'deb http://deb.debian.org/debian stretch-backports main' > /etc/apt/sources.list.d/stretch-backports.list | ||
; \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Default to UTF-8 file.encoding | ||
ENV LANG C.UTF-8 | ||
|
||
# add a simple script that can auto-detect the appropriate JAVA_HOME value | ||
# based on whether the JDK or only the JRE is installed | ||
RUN { \ | ||
echo '#!/bin/sh'; \ | ||
echo 'set -e'; \ | ||
echo; \ | ||
echo 'dirname "$(dirname "$(readlink -f "$(which javac || which java)")")"'; \ | ||
} > /usr/local/bin/docker-java-home \ | ||
&& chmod +x /usr/local/bin/docker-java-home | ||
ENV JAVA_HOME /usr/local/openjdk-11 | ||
ENV PATH $JAVA_HOME/bin:$PATH | ||
|
||
# do some fancy footwork to create a JAVA_HOME that's cross-architecture-safe | ||
RUN ln -svT "/usr/lib/jvm/java-11-openjdk-$(dpkg --print-architecture)" /docker-java-home | ||
ENV JAVA_HOME /docker-java-home | ||
# backwards compatibility shim | ||
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)" ] | ||
|
||
# https://adoptopenjdk.net/upstream.html | ||
ENV JAVA_VERSION 11.0.3 | ||
ENV JAVA_DEBIAN_VERSION 11.0.3+1-1~bpo9+1 | ||
ENV JAVA_BASE_URL https://github.com/AdoptOpenJDK/openjdk11-upstream-binaries/releases/download/jdk-11.0.3%2B7/OpenJDK11U- | ||
ENV JAVA_URL_VERSION 11.0.3_7 | ||
# https://github.com/docker-library/openjdk/issues/320#issuecomment-494050246 | ||
|
||
RUN set -ex; \ | ||
RUN set -eux; \ | ||
\ | ||
# deal with slim variants not having man page directories (which causes "update-alternatives" to fail) | ||
if [ ! -d /usr/share/man/man1 ]; then \ | ||
mkdir -p /usr/share/man/man1; \ | ||
fi; \ | ||
dpkgArch="$(dpkg --print-architecture)"; \ | ||
case "$dpkgArch" in \ | ||
amd64) upstreamArch='x64' ;; \ | ||
arm64) upstreamArch='aarch64' ;; \ | ||
*) echo >&2 "error: unsupported architecture: $dpkgArch" ;; \ | ||
esac; \ | ||
\ | ||
# ca-certificates-java does not work on src:openjdk-11 with no-install-recommends: (https://bugs.debian.org/914860, https://bugs.debian.org/775775) | ||
# /var/lib/dpkg/info/ca-certificates-java.postinst: line 56: java: command not found | ||
ln -svT /docker-java-home/bin/java /usr/local/bin/java; \ | ||
wget -O openjdk.tgz.asc "${JAVA_BASE_URL}${upstreamArch}_linux_${JAVA_URL_VERSION}.tar.gz.sign"; \ | ||
wget -O openjdk.tgz "${JAVA_BASE_URL}${upstreamArch}_linux_${JAVA_URL_VERSION}.tar.gz" --progress=dot:giga; \ | ||
\ | ||
apt-get update; \ | ||
apt-get install -y --no-install-recommends \ | ||
openjdk-11-jdk="$JAVA_DEBIAN_VERSION" \ | ||
; \ | ||
rm -rf /var/lib/apt/lists/*; \ | ||
export GNUPGHOME="$(mktemp -d)"; \ | ||
# 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? | ||
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys CA5F11C6CE22644D42C6AC4492EF8D39DC13168F; \ | ||
gpg --batch --verify openjdk.tgz.asc openjdk.tgz; \ | ||
rm -rf "$GNUPGHOME"; \ | ||
\ | ||
rm -v /usr/local/bin/java; \ | ||
mkdir -p "$JAVA_HOME"; \ | ||
tar --extract --file openjdk.tgz --directory "$JAVA_HOME" --strip-components 1; \ | ||
rm openjdk.tgz*; \ | ||
\ | ||
# 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) | ||
keytool -importkeystore -srckeystore /etc/ssl/certs/java/cacerts -destkeystore /etc/ssl/certs/java/cacerts.jks -deststoretype JKS -srcstorepass changeit -deststorepass changeit -noprompt; \ | ||
mv /etc/ssl/certs/java/cacerts.jks /etc/ssl/certs/java/cacerts; \ | ||
/var/lib/dpkg/info/ca-certificates-java.postinst configure; \ | ||
# TODO strip "demo" and "man" folders? | ||
\ | ||
# verify that "docker-java-home" returns what we expect | ||
[ "$(readlink -f "$JAVA_HOME")" = "$(docker-java-home)" ]; \ | ||
\ | ||
# update-alternatives so that future installs of other OpenJDK versions don't change /usr/bin/java | ||
update-alternatives --get-selections | awk -v home="$(readlink -f "$JAVA_HOME")" 'index($3, home) == 1 { $2 = "manual"; print | "update-alternatives --set-selections" }'; \ | ||
# ... and verify that it actually worked for one of the alternatives we care about | ||
update-alternatives --query java | grep -q 'Status: manual' | ||
# basic smoke test | ||
javac --version; \ | ||
java --version | ||
|
||
# https://docs.oracle.com/javase/10/tools/jshell.htm | ||
# https://en.wikipedia.org/wiki/JShell | ||
# "jshell" is an interactive REPL for Java (see https://en.wikipedia.org/wiki/JShell) | ||
CMD ["jshell"] | ||
|
||
# If you're reading this and have any feedback on how this image could be | ||
# improved, please open an issue or a pull request so we can discuss it! | ||
# | ||
# https://github.com/docker-library/openjdk/issues |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,86 +1,60 @@ | ||
# | ||
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" | ||
# | ||
# PLEASE DO NOT EDIT IT DIRECTLY. | ||
# | ||
|
||
FROM debian:stretch-slim | ||
|
||
# A few reasons for installing distribution-provided OpenJDK: | ||
# | ||
# 1. Oracle. Licensing prevents us from redistributing the official JDK. | ||
# | ||
# 2. Compiling OpenJDK also requires the JDK to be installed, and it gets | ||
# really hairy. | ||
# | ||
# For some sample build times, see Debian's buildd logs: | ||
# https://buildd.debian.org/status/logs.php?pkg=openjdk-11 | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
bzip2 \ | ||
unzip \ | ||
xz-utils \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN echo 'deb http://deb.debian.org/debian stretch-backports main' > /etc/apt/sources.list.d/stretch-backports.list | ||
|
||
# Default to UTF-8 file.encoding | ||
ENV LANG C.UTF-8 | ||
|
||
# add a simple script that can auto-detect the appropriate JAVA_HOME value | ||
# based on whether the JDK or only the JRE is installed | ||
RUN { \ | ||
echo '#!/bin/sh'; \ | ||
echo 'set -e'; \ | ||
echo; \ | ||
echo 'dirname "$(dirname "$(readlink -f "$(which javac || which java)")")"'; \ | ||
} > /usr/local/bin/docker-java-home \ | ||
&& chmod +x /usr/local/bin/docker-java-home | ||
ENV JAVA_HOME /usr/local/openjdk-11 | ||
ENV PATH $JAVA_HOME/bin:$PATH | ||
|
||
# do some fancy footwork to create a JAVA_HOME that's cross-architecture-safe | ||
RUN ln -svT "/usr/lib/jvm/java-11-openjdk-$(dpkg --print-architecture)" /docker-java-home | ||
ENV JAVA_HOME /docker-java-home | ||
# backwards compatibility shim | ||
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)" ] | ||
|
||
# https://adoptopenjdk.net/upstream.html | ||
ENV JAVA_VERSION 11.0.3 | ||
ENV JAVA_DEBIAN_VERSION 11.0.3+1-1~bpo9+1 | ||
ENV JAVA_BASE_URL https://github.com/AdoptOpenJDK/openjdk11-upstream-binaries/releases/download/jdk-11.0.3%2B7/OpenJDK11U- | ||
ENV JAVA_URL_VERSION 11.0.3_7 | ||
# https://github.com/docker-library/openjdk/issues/320#issuecomment-494050246 | ||
|
||
RUN set -ex; \ | ||
RUN set -eux; \ | ||
\ | ||
# deal with slim variants not having man page directories (which causes "update-alternatives" to fail) | ||
if [ ! -d /usr/share/man/man1 ]; then \ | ||
mkdir -p /usr/share/man/man1; \ | ||
fi; \ | ||
\ | ||
# ca-certificates-java does not work on src:openjdk-11 with no-install-recommends: (https://bugs.debian.org/914860, https://bugs.debian.org/775775) | ||
# /var/lib/dpkg/info/ca-certificates-java.postinst: line 56: java: command not found | ||
ln -svT /docker-java-home/bin/java /usr/local/bin/java; \ | ||
dpkgArch="$(dpkg --print-architecture)"; \ | ||
case "$dpkgArch" in \ | ||
amd64) upstreamArch='x64' ;; \ | ||
# 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) | ||
arm64) upstreamArch='aarch64' ;; \ | ||
*) echo >&2 "error: unsupported architecture: $dpkgArch" ;; \ | ||
esac; \ | ||
\ | ||
savedAptMark="$(apt-mark showmanual)"; \ | ||
apt-get update; \ | ||
apt-get install -y --no-install-recommends \ | ||
openjdk-11-jdk-headless="$JAVA_DEBIAN_VERSION" \ | ||
ca-certificates wget \ | ||
gnupg dirmngr \ | ||
; \ | ||
rm -rf /var/lib/apt/lists/*; \ | ||
\ | ||
rm -v /usr/local/bin/java; \ | ||
wget -O openjdk.tgz.asc "${JAVA_BASE_URL}${upstreamArch}_linux_${JAVA_URL_VERSION}.tar.gz.sign"; \ | ||
wget -O openjdk.tgz "${JAVA_BASE_URL}${upstreamArch}_linux_${JAVA_URL_VERSION}.tar.gz" --progress=dot:giga; \ | ||
\ | ||
export GNUPGHOME="$(mktemp -d)"; \ | ||
# 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? | ||
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys CA5F11C6CE22644D42C6AC4492EF8D39DC13168F; \ | ||
gpg --batch --verify openjdk.tgz.asc openjdk.tgz; \ | ||
rm -rf "$GNUPGHOME"; \ | ||
\ | ||
# 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) | ||
keytool -importkeystore -srckeystore /etc/ssl/certs/java/cacerts -destkeystore /etc/ssl/certs/java/cacerts.jks -deststoretype JKS -srcstorepass changeit -deststorepass changeit -noprompt; \ | ||
mv /etc/ssl/certs/java/cacerts.jks /etc/ssl/certs/java/cacerts; \ | ||
/var/lib/dpkg/info/ca-certificates-java.postinst configure; \ | ||
mkdir -p "$JAVA_HOME"; \ | ||
tar --extract --file openjdk.tgz --directory "$JAVA_HOME" --strip-components 1; \ | ||
rm openjdk.tgz*; \ | ||
\ | ||
# verify that "docker-java-home" returns what we expect | ||
[ "$(readlink -f "$JAVA_HOME")" = "$(docker-java-home)" ]; \ | ||
# TODO strip "demo" and "man" folders? | ||
\ | ||
# update-alternatives so that future installs of other OpenJDK versions don't change /usr/bin/java | ||
update-alternatives --get-selections | awk -v home="$(readlink -f "$JAVA_HOME")" 'index($3, home) == 1 { $2 = "manual"; print | "update-alternatives --set-selections" }'; \ | ||
# ... and verify that it actually worked for one of the alternatives we care about | ||
update-alternatives --query java | grep -q 'Status: manual' | ||
apt-mark auto '.*' > /dev/null; \ | ||
[ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \ | ||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ | ||
\ | ||
# basic smoke test | ||
javac --version; \ | ||
java --version | ||
|
||
# https://docs.oracle.com/javase/10/tools/jshell.htm | ||
# https://en.wikipedia.org/wiki/JShell | ||
# "jshell" is an interactive REPL for Java (see https://en.wikipedia.org/wiki/JShell) | ||
CMD ["jshell"] | ||
|
||
# If you're reading this and have any feedback on how this image could be | ||
# improved, please open an issue or a pull request so we can discuss it! | ||
# | ||
# https://github.com/docker-library/openjdk/issues |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
FROM mcr.microsoft.com/windows/servercore:1803 | ||
|
||
# $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324 | ||
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] | ||
|
||
# enable TLS 1.2 (Nano Server doesn't support using "[Net.ServicePointManager]::SecurityProtocol") | ||
# https://docs.microsoft.com/en-us/system-center/vmm/install-tls?view=sc-vmm-1801 | ||
# https://docs.microsoft.com/en-us/windows-server/identity/ad-fs/operations/manage-ssl-protocols-in-ad-fs#enable-tls-12 | ||
RUN Write-Host 'Enabling TLS 1.2 (https://githubengineering.com/crypto-removal-notice/) ...'; \ | ||
$tls12RegBase = 'HKLM:\\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2'; \ | ||
if (Test-Path $tls12RegBase) { throw ('"{0}" already exists!' -f $tls12RegBase) }; \ | ||
New-Item -Path ('{0}/Client' -f $tls12RegBase) -Force; \ | ||
New-Item -Path ('{0}/Server' -f $tls12RegBase) -Force; \ | ||
New-ItemProperty -Path ('{0}/Client' -f $tls12RegBase) -Name 'DisabledByDefault' -PropertyType DWORD -Value 0 -Force; \ | ||
New-ItemProperty -Path ('{0}/Client' -f $tls12RegBase) -Name 'Enabled' -PropertyType DWORD -Value 1 -Force; \ | ||
New-ItemProperty -Path ('{0}/Server' -f $tls12RegBase) -Name 'DisabledByDefault' -PropertyType DWORD -Value 0 -Force; \ | ||
New-ItemProperty -Path ('{0}/Server' -f $tls12RegBase) -Name 'Enabled' -PropertyType DWORD -Value 1 -Force | ||
|
||
ENV JAVA_HOME C:\\openjdk-11 | ||
RUN $newPath = ('{0}\bin;{1}' -f $env:JAVA_HOME, $env:PATH); \ | ||
Write-Host ('Updating PATH: {0}' -f $newPath); \ | ||
# Nano Server does not have "[Environment]::SetEnvironmentVariable()" | ||
setx /M PATH $newPath | ||
|
||
# https://adoptopenjdk.net/upstream.html | ||
ENV JAVA_VERSION 11.0.3 | ||
ENV JAVA_BASE_URL https://github.com/AdoptOpenJDK/openjdk11-upstream-binaries/releases/download/jdk-11.0.3%2B7/OpenJDK11U- | ||
ENV JAVA_URL_VERSION 11.0.3_7 | ||
# https://github.com/docker-library/openjdk/issues/320#issuecomment-494050246 | ||
|
||
RUN $url = ('{0}x64_windows_{1}.zip' -f $env:JAVA_BASE_URL, $env:JAVA_URL_VERSION); \ | ||
Write-Host ('Downloading {0} ...' -f $url); \ | ||
Invoke-WebRequest -Uri $url -OutFile 'openjdk.zip'; \ | ||
# TODO signature? checksum? | ||
\ | ||
Write-Host 'Expanding ...'; \ | ||
New-Item -ItemType Directory -Path C:\temp | Out-Null; \ | ||
Expand-Archive openjdk.zip -DestinationPath C:\temp; \ | ||
Move-Item -Path C:\temp\* -Destination $env:JAVA_HOME; \ | ||
Remove-Item C:\temp; \ | ||
\ | ||
Write-Host 'Removing ...'; \ | ||
Remove-Item openjdk.zip -Force; \ | ||
\ | ||
Write-Host 'Verifying install ...'; \ | ||
Write-Host ' javac --version'; javac --version; \ | ||
Write-Host ' java --version'; java --version; \ | ||
\ | ||
Write-Host 'Complete.' | ||
|
||
# "jshell" is an interactive REPL for Java (see https://en.wikipedia.org/wiki/JShell) | ||
CMD ["jshell"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
FROM mcr.microsoft.com/windows/servercore:1809 | ||
|
||
# $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324 | ||
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] | ||
|
||
# enable TLS 1.2 (Nano Server doesn't support using "[Net.ServicePointManager]::SecurityProtocol") | ||
# https://docs.microsoft.com/en-us/system-center/vmm/install-tls?view=sc-vmm-1801 | ||
# https://docs.microsoft.com/en-us/windows-server/identity/ad-fs/operations/manage-ssl-protocols-in-ad-fs#enable-tls-12 | ||
RUN Write-Host 'Enabling TLS 1.2 (https://githubengineering.com/crypto-removal-notice/) ...'; \ | ||
$tls12RegBase = 'HKLM:\\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2'; \ | ||
if (Test-Path $tls12RegBase) { throw ('"{0}" already exists!' -f $tls12RegBase) }; \ | ||
New-Item -Path ('{0}/Client' -f $tls12RegBase) -Force; \ | ||
New-Item -Path ('{0}/Server' -f $tls12RegBase) -Force; \ | ||
New-ItemProperty -Path ('{0}/Client' -f $tls12RegBase) -Name 'DisabledByDefault' -PropertyType DWORD -Value 0 -Force; \ | ||
New-ItemProperty -Path ('{0}/Client' -f $tls12RegBase) -Name 'Enabled' -PropertyType DWORD -Value 1 -Force; \ | ||
New-ItemProperty -Path ('{0}/Server' -f $tls12RegBase) -Name 'DisabledByDefault' -PropertyType DWORD -Value 0 -Force; \ | ||
New-ItemProperty -Path ('{0}/Server' -f $tls12RegBase) -Name 'Enabled' -PropertyType DWORD -Value 1 -Force | ||
|
||
ENV JAVA_HOME C:\\openjdk-11 | ||
RUN $newPath = ('{0}\bin;{1}' -f $env:JAVA_HOME, $env:PATH); \ | ||
Write-Host ('Updating PATH: {0}' -f $newPath); \ | ||
# Nano Server does not have "[Environment]::SetEnvironmentVariable()" | ||
setx /M PATH $newPath | ||
|
||
# https://adoptopenjdk.net/upstream.html | ||
ENV JAVA_VERSION 11.0.3 | ||
ENV JAVA_BASE_URL https://github.com/AdoptOpenJDK/openjdk11-upstream-binaries/releases/download/jdk-11.0.3%2B7/OpenJDK11U- | ||
ENV JAVA_URL_VERSION 11.0.3_7 | ||
# https://github.com/docker-library/openjdk/issues/320#issuecomment-494050246 | ||
|
||
RUN $url = ('{0}x64_windows_{1}.zip' -f $env:JAVA_BASE_URL, $env:JAVA_URL_VERSION); \ | ||
Write-Host ('Downloading {0} ...' -f $url); \ | ||
Invoke-WebRequest -Uri $url -OutFile 'openjdk.zip'; \ | ||
# TODO signature? checksum? | ||
\ | ||
Write-Host 'Expanding ...'; \ | ||
New-Item -ItemType Directory -Path C:\temp | Out-Null; \ | ||
Expand-Archive openjdk.zip -DestinationPath C:\temp; \ | ||
Move-Item -Path C:\temp\* -Destination $env:JAVA_HOME; \ | ||
Remove-Item C:\temp; \ | ||
\ | ||
Write-Host 'Removing ...'; \ | ||
Remove-Item openjdk.zip -Force; \ | ||
\ | ||
Write-Host 'Verifying install ...'; \ | ||
Write-Host ' javac --version'; javac --version; \ | ||
Write-Host ' java --version'; java --version; \ | ||
\ | ||
Write-Host 'Complete.' | ||
|
||
# "jshell" is an interactive REPL for Java (see https://en.wikipedia.org/wiki/JShell) | ||
CMD ["jshell"] |
Oops, something went wrong.