https://github.com/bwibo/oracle-java-docker
Basic Dockerfile for Oracle Java
https://github.com/bwibo/oracle-java-docker
builder docker dockerfile git gradle java jdk oracle oracle-java oracle-jdk-builder-image wget
Last synced: 3 months ago
JSON representation
Basic Dockerfile for Oracle Java
- Host: GitHub
- URL: https://github.com/bwibo/oracle-java-docker
- Owner: BWibo
- License: apache-2.0
- Created: 2021-03-01T17:19:02.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-01-14T18:12:56.000Z (over 3 years ago)
- Last Synced: 2025-02-15T23:25:44.257Z (4 months ago)
- Topics: builder, docker, dockerfile, git, gradle, java, jdk, oracle, oracle-java, oracle-jdk-builder-image, wget
- Language: Dockerfile
- Homepage:
- Size: 12.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Oracle JDK Docker
This repo contains a basic `Dockerfile` for Ubuntu with Oracle Java and a *builder* `Dockerfile`
including *Gradle*, *git* and *wget*.## How to build
1. Clone this repo and `cd` to the repo folder.
`git clone https://github.com/BWibo/oracle-java-docker.git && cd oracle-java-docker`
2. Download Oracle JDK Linux `tar.gz` from: https://www.oracle.com/de/java/technologies/javase-downloads.html
For JDK version 11.0.10 you will get ``jdk-11.0.10_linux-x64_bin.tar.gz``.
3. Copy this file to the repo root.
4. Build image:
`docker build -t myrepo/oracle-jdk:jdk-11.0.10 --build-arg JAVA_VERSION=jdk-11.0.10`.
5. Test image:
```shell
$ docker run --rm myrepo/oracle-jdk:jdk-11.0.10 java -versionjava version "11.0.10" 2021-01-19 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.10+8-LTS-162)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.10+8-LTS-162, mixed mode)
```### Build args
| Arg | Default | Description |
|---------------|----------------------------------------|-------------------------------------------------------------------------------------------------------|
| BASEIMAGE_TAG | `20.04` | Tag of the `ubuntu` Docker image to use as base image |
| JAVA_VERSION | `jdk-11.0.11` | Java version that is used. Name of the jdk folder inside the downloaded JDK `*.tar.gz` |
| JAVA_FILENAME | `${JAVA_VERSION}_linux-x64_bin.tar.gz` | File name of the downloaded JDK `*.tar.gz` |
| INSTALL_DIR | `/usr/lib/jdk` | Install dir of the JDK inside the container. `$JAVA_HOME` will be set to `$INSTALL_DIR/$JAVA_VERSION` |## Builder Dockerfile
The *builder* Dockerfile is based on the *Oracle-JDK* `Dockerfile`. To build the image follow the steps above, but use this to build the image:
`docker build -t myrepo/oracle-jdk-builder:jdk-11.0.11 --build-arg JAVA_VERSION=jdk-11.0.11 -f oracle-java-builder.dockerfile .`
### Build args| Arg | Default | Description |
|----------------|----------------------------------------|-------------------------------------------------------------------------------------------------------|
| JAVA_VERSION | `jdk-11.0.11` | Java version that is used. Name of the jdk folder inside the downloaded JDK `*.tar.gz` |
| INSTALL_DIR | `/usr/lib/jdk` | Install dir of the JDK inside the container. `$JAVA_HOME` will be set to `$INSTALL_DIR/$JAVA_VERSION` |
| GRADLE_VERSION | `7.0.2` | Gradle version that is used for the image |