|
| 1 | +# Docker images containing installer for Oracle JDK 8 and 11 on Windows |
| 2 | + |
| 3 | +This folder contains Dockerfiles to build images that contain Oracle JDK 8 or 11 installer for Windows. |
| 4 | +We need such image because no [official Oracle JDK image](https://container-registry.oracle.com/ords/ocr/ba/java/jdk) for Windows architecture exists to this date. |
| 5 | +These image purpose is to help install Oracle JDK 8 and 11 on the GitHub Windows action runner. |
| 6 | +The runner will create the image containing the JDK installer and copy it locally for installation after which the started image is discarded. |
| 7 | +For example, the runner will do the following steps to retrieve JDK 8 installer: |
| 8 | + |
| 9 | +```console |
| 10 | +$container_id=$(docker create "ghcr.io/scalar-labs/oracle/jdk:8-windows") |
| 11 | +docker cp "${container_id}:oracle-jdk.exe" . |
| 12 | +docker rm "$container_id" |
| 13 | +//Continue with the JDK installation |
| 14 | +``` |
| 15 | + |
| 16 | +The capability of the `mcr.microsoft.com/oss/kubernetes/windows-host-process-containers-base-image` base image is irrelevant since the container is never run. |
| 17 | +It was selected solely because its memory footprint is very light (7KB). |
| 18 | + |
| 19 | +## How to build the images |
| 20 | +### Download the JDK installer |
| 21 | + |
| 22 | +Download the `Windows x64 Installer` installer from [Oracle website](https://www.oracle.com/java/technologies/downloads/archive/#JavaSE) for JDK 8 and 11. An Oracle account (registration is free) is needed. |
| 23 | + |
| 24 | +Then put the downloaded files in the corresponding directories with the Dockerfile |
| 25 | + |
| 26 | +### Build the Docker images |
| 27 | + |
| 28 | +These builds steps are directly taken from the base image `mcr.microsoft.com/oss/kubernetes/windows-host-process-containers-base-image` [GitHub repository](https://github.com/microsoft/windows-host-process-containers-base-image?tab=readme-ov-file#build-with-buildkit). |
| 29 | + |
| 30 | +To be able to build a Windows image on a Linux machine, we need to create a specific build environment. |
| 31 | + |
| 32 | +```console |
| 33 | +docker buildx create --name img-builder --use --platform windows/amd64 |
| 34 | +``` |
| 35 | + |
| 36 | +Since the image requires a Windows architecture, it cannot be exported locally after being build, |
| 37 | +we need to push it to the registry right away. |
| 38 | + |
| 39 | +The following commands will build then push the Windows image to the Scalar GitHub registry. |
| 40 | + |
| 41 | +#### For JDK 8 |
| 42 | + |
| 43 | +```console |
| 44 | +docker buildx build --platform windows/amd64 --output=type=registry -t ghcr.io/scalar-labs/oracle/jdk:8-windows -t ghcr.io/scalar-labs/oracle/jdk:8u401-windows ./8 |
| 45 | +``` |
| 46 | + |
| 47 | +#### For JDK 11 |
| 48 | + |
| 49 | +```console |
| 50 | +docker buildx build --platform windows/amd64 --output=type=registry -t ghcr.io/scalar-labs/oracle/jdk:11-windows -t ghcr.io/scalar-labs/oracle/jdk:11.0.22-windows ./11 |
| 51 | +``` |
0 commit comments