Skip to content

Commit

Permalink
Merge pull request #251 from OpenLiberty/staging
Browse files Browse the repository at this point in the history
Merge staging to prod - Explain features.sh and configure.sh in Dockerfile (#242)
  • Loading branch information
gkwan-ibm authored Nov 12, 2024
2 parents e21897c + 0a28a84 commit c55442d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
10 changes: 7 additions & 3 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,15 @@ Dockerfile
include::finish/Dockerfile[]
----

The [hotspot=from file=0]`FROM` instruction initializes a new build stage and indicates the parent image from which your image is built. If you don't need a parent image, then use `FROM scratch`, which makes your image a base image.
The [hotspot=from file=0]`FROM` instruction initializes a new build stage and indicates the parent image from which your image is built. If you don't need a parent image, then use `FROM scratch`, which makes your image a base image. In this case, you’re using the `icr.io/appcafe/open-liberty:kernel-slim-java11-openj9-ubi` image as your parent image, which comes with the latest Open Liberty runtime.

In this case, you’re using the `icr.io/appcafe/open-liberty:kernel-slim-java11-openj9-ubi` image as your parent image, which comes with the latest Open Liberty runtime.
The [hotspot=copy1 hotspot=copy2 file=0]`COPY` instructions are structured as `COPY` `[--chown=<user>:<group>]` `<source>` `<destination>`. They copy local files into the specified destination within your Docker image. In this case, the Liberty configuration file that is located at `src/main/liberty/config/server.xml` is copied to the `/config/` destination directory.

The [hotspot=copy file=0]`COPY` instructions are structured as `COPY` `[--chown=<user>:<group>]` `<source>` `<destination>`. They copy local files into the specified destination within your Docker image. In this case, the Liberty configuration file that is located at `src/main/liberty/config/server.xml` is copied to the `/config/` destination directory.
The [hotspot=features hotspot=configure file=0]`RUN` instructions execute commands in a new layer on top of the current image and commit the results. In this case, they run the [hotspot=features file=0]`features.sh` and [hotspot=configure file=0]`configure.sh` scripts to install the required features and finalize the server configuration for your Open Liberty application.

The [hotspot=features file=0]`features.sh` script adds the requested XML snippets to enable Liberty features by using https://openliberty.io/docs/latest/reference/command/featureUtility-commands.html[featureUtility^]. Because you're starting with the [hotspot=from file=0]`kernel-slim` image, which provides only the bare minimum server, the script reads your `server.xml` file to identify the required features and installs them into your Docker image.

The [hotspot=configure file=0]`configure.sh` script adds the requested server configurations, applies any interim fixes, and populates caches to optimize the runtime.

=== Writing a .dockerignore file

Expand Down
10 changes: 8 additions & 2 deletions finish/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,18 @@ LABEL \
USER root
# end::user-root[]

# tag::copy[]
# tag::copy1[]
COPY --chown=1001:0 src/main/liberty/config/server.xml /config/
# end::copy1[]
# tag::features[]
RUN features.sh
# end::features[]
# tag::copy2[]
COPY --chown=1001:0 target/*.war /config/apps/
# end::copy[]
# end::copy2[]
# tag::configure[]
RUN configure.sh
# end::configure[]
# tag::user[]
USER 1001
# end::user[]

0 comments on commit c55442d

Please sign in to comment.