Skip to content

Commit

Permalink
updating JDK + JRE READMEs (#2050)
Browse files Browse the repository at this point in the history
* updating JDK + JRE READMEs

Signed-off-by: Mark Drake <mark@chainguard.dev>

* Fixing README error that Erin caught

Signed-off-by: Mark Drake <mark@chainguard.dev>

---------

Signed-off-by: Mark Drake <mark@chainguard.dev>
  • Loading branch information
SharpRake authored Jan 6, 2024
1 parent f021369 commit 8ce5deb
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 14 deletions.
20 changes: 13 additions & 7 deletions images/jdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ docker pull cgr.dev/chainguard/jdk:latest
<!--getting:end-->

<!--body:start-->
## Use it
## Java Application Example

Create a simple Java class
This section outlines how you can build a Java application with the Chainguard JDK Image.

Start by creating a sample Java class named `HelloWolfi.java`:

```sh
cat >HelloWolfi.java <<EOL
Expand All @@ -42,7 +44,7 @@ class HelloWolfi
EOL
```

Next create a multistage Dockerfile and add the Java class
Then create a multistage Dockerfile, adding the Java class you just created:

```sh
cat >Dockerfile <<EOL
Expand All @@ -58,14 +60,18 @@ CMD ["HelloWolfi"]
EOL
```

Build the image
Following that, you can build the image:

```sh
docker build -t my-simple-java-app .
docker build -t my-java-app .
```

Run the image
Note that this example tags the image with `my-java-app`. You can now run the image by referencing this tag, as in the following command:

```sh
docker run my-simple-java-app
docker run my-java-app
```
```
Hello Wolfi users!
```
<!--body:end-->
20 changes: 13 additions & 7 deletions images/jre/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ docker pull cgr.dev/chainguard/jre:latest
<!--getting:end-->

<!--body:start-->
## Use it
## Java Application Example

Create a simple Java class
This section outlines how you can build a Java application with the Chainguard JRE Image.

Start by creating a sample Java class named `HelloWolfi.java`:

```sh
cat >HelloWolfi.java <<EOL
Expand All @@ -42,7 +44,7 @@ class HelloWolfi
EOL
```

Next create a multistage Dockerfile and add the Java class
Then create a multistage Dockerfile, adding the Java class you just created:

```sh
cat >Dockerfile <<EOL
Expand All @@ -58,14 +60,18 @@ CMD ["HelloWolfi"]
EOL
```

Build the image
Following that, you can build the image:

```sh
docker build -t my-simple-java-app .
docker build -t my-java-app .
```

Run the image
Note that this example tags the image with `my-java-app`. You can now run the image by referencing this tag, as in the following command:

```sh
docker run my-simple-java-app
docker run my-java-app
```
```
Hello Wolfi users!
```
<!--body:end-->

0 comments on commit 8ce5deb

Please sign in to comment.