Skip to content

Commit

Permalink
Add initial Nano Server variants
Browse files Browse the repository at this point in the history
  • Loading branch information
tianon committed Jul 3, 2019
1 parent d368a4f commit e4f01b5
Show file tree
Hide file tree
Showing 16 changed files with 283 additions and 2 deletions.
12 changes: 12 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,37 @@ matrix:
- os: windows
dist: 1803-containers
env: VERSION=13 VARIANT=windows/windowsservercore-1803
- os: windows
dist: 1803-containers
env: VERSION=13 VARIANT=windows/nanoserver-1803
- os: linux
env: VERSION=12 VARIANT=oracle
- os: windows
dist: 1803-containers
env: VERSION=12 VARIANT=windows/windowsservercore-1803
- os: windows
dist: 1803-containers
env: VERSION=12 VARIANT=windows/nanoserver-1803
- os: linux
env: VERSION=11
- os: linux
env: VERSION=11 VARIANT=slim
- os: windows
dist: 1803-containers
env: VERSION=11 VARIANT=windows/windowsservercore-1803
- os: windows
dist: 1803-containers
env: VERSION=11 VARIANT=windows/nanoserver-1803
- os: linux
env: VERSION=8
- os: linux
env: VERSION=8 VARIANT=slim
- os: windows
dist: 1803-containers
env: VERSION=8 VARIANT=windows/windowsservercore-1803
- os: windows
dist: 1803-containers
env: VERSION=8 VARIANT=windows/nanoserver-1803

install:
- git clone https://github.com/docker-library/official-images.git ~/official-images
Expand Down
23 changes: 23 additions & 0 deletions 11/jdk/windows/nanoserver-1803/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM mcr.microsoft.com/windows/nanoserver:1803

SHELL ["cmd", "/s", "/c"]

ENV JAVA_HOME C:\\openjdk-11
# "ERROR: Access to the registry path is denied."
USER ContainerAdministrator
RUN echo Updating PATH: %JAVA_HOME%\bin;%PATH% \
&& setx /M PATH %JAVA_HOME%\bin;%PATH%
USER ContainerUser

# https://adoptopenjdk.net/upstream.html
ENV JAVA_VERSION 11.0.3
# https://github.com/docker-library/openjdk/issues/320#issuecomment-494050246

COPY --from=openjdk:11.0.3-windowsservercore-1803 $JAVA_HOME $JAVA_HOME

RUN echo Verifying install ... \
&& echo javac --version && javac --version \
&& echo java --version && java --version

# "jshell" is an interactive REPL for Java (see https://en.wikipedia.org/wiki/JShell)
CMD ["jshell"]
23 changes: 23 additions & 0 deletions 11/jdk/windows/nanoserver-1809/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM mcr.microsoft.com/windows/nanoserver:1809

SHELL ["cmd", "/s", "/c"]

ENV JAVA_HOME C:\\openjdk-11
# "ERROR: Access to the registry path is denied."
USER ContainerAdministrator
RUN echo Updating PATH: %JAVA_HOME%\bin;%PATH% \
&& setx /M PATH %JAVA_HOME%\bin;%PATH%
USER ContainerUser

# https://adoptopenjdk.net/upstream.html
ENV JAVA_VERSION 11.0.3
# https://github.com/docker-library/openjdk/issues/320#issuecomment-494050246

COPY --from=openjdk:11.0.3-windowsservercore-1809 $JAVA_HOME $JAVA_HOME

RUN echo Verifying install ... \
&& echo javac --version && javac --version \
&& echo java --version && java --version

# "jshell" is an interactive REPL for Java (see https://en.wikipedia.org/wiki/JShell)
CMD ["jshell"]
22 changes: 22 additions & 0 deletions 12/jdk/windows/nanoserver-1803/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM mcr.microsoft.com/windows/nanoserver:1803

SHELL ["cmd", "/s", "/c"]

ENV JAVA_HOME C:\\openjdk-12
# "ERROR: Access to the registry path is denied."
USER ContainerAdministrator
RUN echo Updating PATH: %JAVA_HOME%\bin;%PATH% \
&& setx /M PATH %JAVA_HOME%\bin;%PATH%
USER ContainerUser

# https://jdk.java.net/
ENV JAVA_VERSION 12.0.1

COPY --from=openjdk:12.0.1-windowsservercore-1803 $JAVA_HOME $JAVA_HOME

RUN echo Verifying install ... \
&& echo javac --version && javac --version \
&& echo java --version && java --version

# "jshell" is an interactive REPL for Java (see https://en.wikipedia.org/wiki/JShell)
CMD ["jshell"]
22 changes: 22 additions & 0 deletions 12/jdk/windows/nanoserver-1809/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM mcr.microsoft.com/windows/nanoserver:1809

SHELL ["cmd", "/s", "/c"]

ENV JAVA_HOME C:\\openjdk-12
# "ERROR: Access to the registry path is denied."
USER ContainerAdministrator
RUN echo Updating PATH: %JAVA_HOME%\bin;%PATH% \
&& setx /M PATH %JAVA_HOME%\bin;%PATH%
USER ContainerUser

# https://jdk.java.net/
ENV JAVA_VERSION 12.0.1

COPY --from=openjdk:12.0.1-windowsservercore-1809 $JAVA_HOME $JAVA_HOME

RUN echo Verifying install ... \
&& echo javac --version && javac --version \
&& echo java --version && java --version

# "jshell" is an interactive REPL for Java (see https://en.wikipedia.org/wiki/JShell)
CMD ["jshell"]
22 changes: 22 additions & 0 deletions 13/jdk/windows/nanoserver-1803/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM mcr.microsoft.com/windows/nanoserver:1803

SHELL ["cmd", "/s", "/c"]

ENV JAVA_HOME C:\\openjdk-13
# "ERROR: Access to the registry path is denied."
USER ContainerAdministrator
RUN echo Updating PATH: %JAVA_HOME%\bin;%PATH% \
&& setx /M PATH %JAVA_HOME%\bin;%PATH%
USER ContainerUser

# https://jdk.java.net/
ENV JAVA_VERSION 13-ea+27

COPY --from=openjdk:13-ea-27-windowsservercore-1803 $JAVA_HOME $JAVA_HOME

RUN echo Verifying install ... \
&& echo javac --version && javac --version \
&& echo java --version && java --version

# "jshell" is an interactive REPL for Java (see https://en.wikipedia.org/wiki/JShell)
CMD ["jshell"]
22 changes: 22 additions & 0 deletions 13/jdk/windows/nanoserver-1809/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM mcr.microsoft.com/windows/nanoserver:1809

SHELL ["cmd", "/s", "/c"]

ENV JAVA_HOME C:\\openjdk-13
# "ERROR: Access to the registry path is denied."
USER ContainerAdministrator
RUN echo Updating PATH: %JAVA_HOME%\bin;%PATH% \
&& setx /M PATH %JAVA_HOME%\bin;%PATH%
USER ContainerUser

# https://jdk.java.net/
ENV JAVA_VERSION 13-ea+27

COPY --from=openjdk:13-ea-27-windowsservercore-1809 $JAVA_HOME $JAVA_HOME

RUN echo Verifying install ... \
&& echo javac --version && javac --version \
&& echo java --version && java --version

# "jshell" is an interactive REPL for Java (see https://en.wikipedia.org/wiki/JShell)
CMD ["jshell"]
20 changes: 20 additions & 0 deletions 8/jdk/windows/nanoserver-1803/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM mcr.microsoft.com/windows/nanoserver:1803

SHELL ["cmd", "/s", "/c"]

ENV JAVA_HOME C:\\openjdk-8
# "ERROR: Access to the registry path is denied."
USER ContainerAdministrator
RUN echo Updating PATH: %JAVA_HOME%\bin;%PATH% \
&& setx /M PATH %JAVA_HOME%\bin;%PATH%
USER ContainerUser

# https://adoptopenjdk.net/upstream.html
ENV JAVA_VERSION 8u212-b04
# https://github.com/docker-library/openjdk/issues/320#issuecomment-494050246

COPY --from=openjdk:8u212-b04-windowsservercore-1803 $JAVA_HOME $JAVA_HOME

RUN echo Verifying install ... \
&& echo javac -version && javac -version \
&& echo java -version && java -version
20 changes: 20 additions & 0 deletions 8/jdk/windows/nanoserver-1809/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM mcr.microsoft.com/windows/nanoserver:1809

SHELL ["cmd", "/s", "/c"]

ENV JAVA_HOME C:\\openjdk-8
# "ERROR: Access to the registry path is denied."
USER ContainerAdministrator
RUN echo Updating PATH: %JAVA_HOME%\bin;%PATH% \
&& setx /M PATH %JAVA_HOME%\bin;%PATH%
USER ContainerUser

# https://adoptopenjdk.net/upstream.html
ENV JAVA_VERSION 8u212-b04
# https://github.com/docker-library/openjdk/issues/320#issuecomment-494050246

COPY --from=openjdk:8u212-b04-windowsservercore-1809 $JAVA_HOME $JAVA_HOME

RUN echo Verifying install ... \
&& echo javac -version && javac -version \
&& echo java -version && java -version
19 changes: 19 additions & 0 deletions 8/jre/windows/nanoserver-1803/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM mcr.microsoft.com/windows/nanoserver:1803

SHELL ["cmd", "/s", "/c"]

ENV JAVA_HOME C:\\openjdk-8
# "ERROR: Access to the registry path is denied."
USER ContainerAdministrator
RUN echo Updating PATH: %JAVA_HOME%\bin;%PATH% \
&& setx /M PATH %JAVA_HOME%\bin;%PATH%
USER ContainerUser

# https://adoptopenjdk.net/upstream.html
ENV JAVA_VERSION 8u212-b04
# https://github.com/docker-library/openjdk/issues/320#issuecomment-494050246

COPY --from=openjdk:8u212-b04-windowsservercore-1803 $JAVA_HOME $JAVA_HOME

RUN echo Verifying install ... \
&& echo java -version && java -version
19 changes: 19 additions & 0 deletions 8/jre/windows/nanoserver-1809/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM mcr.microsoft.com/windows/nanoserver:1809

SHELL ["cmd", "/s", "/c"]

ENV JAVA_HOME C:\\openjdk-8
# "ERROR: Access to the registry path is denied."
USER ContainerAdministrator
RUN echo Updating PATH: %JAVA_HOME%\bin;%PATH% \
&& setx /M PATH %JAVA_HOME%\bin;%PATH%
USER ContainerUser

# https://adoptopenjdk.net/upstream.html
ENV JAVA_VERSION 8u212-b04
# https://github.com/docker-library/openjdk/issues/320#issuecomment-494050246

COPY --from=openjdk:8u212-b04-windowsservercore-1809 $JAVA_HOME $JAVA_HOME

RUN echo Verifying install ... \
&& echo java -version && java -version
27 changes: 27 additions & 0 deletions Dockerfile-adopt-windows-nanoserver.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM placeholder

SHELL ["cmd", "/s", "/c"]

ENV JAVA_HOME placeholder
# "ERROR: Access to the registry path is denied."
USER ContainerAdministrator
RUN echo Updating PATH: %JAVA_HOME%\bin;%PATH% \
&& setx /M PATH %JAVA_HOME%\bin;%PATH%
USER ContainerUser

# https://adoptopenjdk.net/upstream.html
ENV JAVA_VERSION placeholder
# https://github.com/docker-library/openjdk/issues/320#issuecomment-494050246

COPY --from=%%SERVERCORE-IMAGE%% $JAVA_HOME $JAVA_HOME

RUN echo Verifying install ... \
&& echo javac --version && javac --version \
&& echo java --version && java --version

# TODO "Launching JShell execution engine threw: C:\openjdk-13\bin\net.dll: Can't find dependent libraries"
# https://bugs.openjdk.java.net/browse/JDK-8218486
# https://bugs.openjdk.java.net/browse/JDK-8225425

# "jshell" is an interactive REPL for Java (see https://en.wikipedia.org/wiki/JShell)
CMD ["jshell"]
File renamed without changes.
26 changes: 26 additions & 0 deletions Dockerfile-oracle-windows-nanoserver.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM placeholder

SHELL ["cmd", "/s", "/c"]

ENV JAVA_HOME placeholder
# "ERROR: Access to the registry path is denied."
USER ContainerAdministrator
RUN echo Updating PATH: %JAVA_HOME%\bin;%PATH% \
&& setx /M PATH %JAVA_HOME%\bin;%PATH%
USER ContainerUser

# https://jdk.java.net/
ENV JAVA_VERSION placeholder

COPY --from=%%SERVERCORE-IMAGE%% $JAVA_HOME $JAVA_HOME

RUN echo Verifying install ... \
&& echo javac --version && javac --version \
&& echo java --version && java --version

# TODO "Launching JShell execution engine threw: C:\openjdk-13\bin\net.dll: Can't find dependent libraries"
# https://bugs.openjdk.java.net/browse/JDK-8218486
# https://bugs.openjdk.java.net/browse/JDK-8225425

# "jshell" is an interactive REPL for Java (see https://en.wikipedia.org/wiki/JShell)
CMD ["jshell"]
File renamed without changes.
8 changes: 6 additions & 2 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,12 @@ for javaVersion in "${versions[@]}"; do
windowsVariant="${windowsVersion%%-*}" # "windowsservercore", "nanoserver"
windowsVersion="${windowsVersion#$windowsVariant-}" # "1803", "ltsc2016", etc
windowsVariant="${windowsVariant#windows}" # "servercore", "nanoserver"
serverCoreImage="openjdk:$adoptVersion-windowsservercore-$windowsVersion" # "openjdk:8u212-b04-windowsservercore-1809", etc
sed -r "${sedArgs[@]}" \
-e 's!^(ENV JAVA_HOME) .*!\1 C:\\\\openjdk-'"$javaVersion"'!' \
-e 's!^(FROM) .*$!\1 mcr.microsoft.com/windows/'"$windowsVariant"':'"$windowsVersion"'!' \
Dockerfile-adopt-windows.template > "$winD/Dockerfile"
-e 's!%%SERVERCORE-IMAGE%%!'"$serverCoreImage"'!g' \
"Dockerfile-adopt-windows-$windowsVariant.template" > "$winD/Dockerfile"
dockerfiles+=( "$winD/Dockerfile" )
done
fi
Expand Down Expand Up @@ -232,13 +234,15 @@ for javaVersion in "${versions[@]}"; do
windowsVariant="${windowsVersion%%-*}" # "windowsservercore", "nanoserver"
windowsVersion="${windowsVersion#$windowsVariant-}" # "1803", "ltsc2016", etc
windowsVariant="${windowsVariant#windows}" # "servercore", "nanoserver"
serverCoreImage="openjdk:${downloadVersion//+/-}-windowsservercore-$windowsVersion" # "openjdk:8u212-b04-windowsservercore-1809", etc
sed -r \
-e 's!^(FROM) .*$!\1 mcr.microsoft.com/windows/'"$windowsVariant"':'"$windowsVersion"'!' \
-e 's!^(ENV JAVA_HOME) .*!\1 C:\\\\openjdk-'"$javaVersion"'!' \
-e 's!^(ENV JAVA_VERSION) .*!\1 '"$downloadVersion"'!' \
-e 's!^(ENV JAVA_URL) .*!\1 '"$downloadUrl"'!' \
-e 's!^(ENV JAVA_SHA256) .*!\1 '"$downloadSha256"'!' \
Dockerfile-oracle-windows.template > "$winD/Dockerfile"
-e 's!%%SERVERCORE-IMAGE%%!'"$serverCoreImage"'!g' \
"Dockerfile-oracle-windows-$windowsVariant.template" > "$winD/Dockerfile"
done
fi
;;
Expand Down

0 comments on commit e4f01b5

Please sign in to comment.