forked from pool/openjdk-11-image
Compare commits
2 Commits
118a2df21b
...
e9a6abaeae
Author | SHA256 | Date | |
---|---|---|---|
e9a6abaeae | |||
4554d1dcdc |
58
README.md
58
README.md
@@ -1,7 +1,61 @@
|
||||
# The openSUSE Tumbleweed BCI OpenJDK 11 runtime container image
|
||||
# OpenJDK 11 runtime container image
|
||||
|
||||

|
||||
|
||||
OpenJDK 11 runtime container based on the openSUSE Tumbleweed Base Container Image.
|
||||
## Description
|
||||
|
||||
[OpenJDK](https://openjdk.org/) (Open Java Development Kit) is a free and open source implementation of the Java Platform, Standard Edition (Java SE). OpenJDK is the official reference implementation of Java SE since version 7.
|
||||
|
||||
The OpenJDK runtime image is intended to be used as a runtime environment. For development, use the OpenJDK development image.
|
||||
|
||||
## Usage
|
||||
|
||||
To run a jar or war application inside a container instance, use the following command:
|
||||
|
||||
```ShellSession
|
||||
$ podman run --rm -v "$PWD":/app:Z -w /app registry.opensuse.org/opensuse/bci/openjdk:11 java -jar hello.jar
|
||||
```
|
||||
|
||||
Or create a new contained based on OpenJDK 11 runtime image:
|
||||
|
||||
```Dockerfile
|
||||
FROM registry.opensuse.org/opensuse/bci/openjdk:11
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . ./
|
||||
|
||||
CMD ["java", "-jar", "hello.jar"]
|
||||
```
|
||||
|
||||
To compile and deploy an application, copy the sources and build the application:
|
||||
|
||||
```Dockerfile
|
||||
# Build the application using the OpenJDK development image
|
||||
FROM registry.suse.com/bci/openjdk-devel:11 as build
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . ./
|
||||
|
||||
RUN javac Hello.java
|
||||
|
||||
# Bundle the application into OpenJDK runtime image
|
||||
FROM registry.opensuse.org/opensuse/bci/openjdk:11
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=build /app/Hello.class /app
|
||||
|
||||
CMD ["java", "Hello"]
|
||||
```
|
||||
|
||||
Build and run the container image:
|
||||
|
||||
```ShellSession
|
||||
$ podman build -t my-java-app .
|
||||
$ podman run -it --rm my-java-app
|
||||
```
|
||||
|
||||
## Licensing
|
||||
|
||||
|
@@ -1,3 +1,8 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Jul 11 08:17:40 UTC 2024 - Alexandre Vicenzi <alexandre.vicenzi@suse.com>
|
||||
|
||||
- extend README.md
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Jun 18 17:24:16 UTC 2024 - Dirk Mueller <dmueller@suse.com>
|
||||
|
||||
|
Reference in New Issue
Block a user