-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
10d8863
commit 5f6e8b2
Showing
10 changed files
with
420 additions
and
87 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# SPDX-License-Identifier: MIT | ||
|
||
# Copyright (c) 2024 SUSE LLC | ||
|
||
# All modifications and additions to the file contributed by third parties | ||
# remain the property of their copyright owners, unless otherwise agreed | ||
# upon. | ||
|
||
# The content of THIS FILE IS AUTOGENERATED and should not be manually modified. | ||
# It is maintained by the BCI team and generated by | ||
# https://github.com/SUSE/BCI-dockerfile-generator | ||
|
||
# Please submit bugfixes or comments via https://bugs.opensuse.org/ | ||
# You can contact the BCI team via https://github.com/SUSE/bci/discussions | ||
|
||
|
||
#!BuildTag: suse/tomcat:10 | ||
#!BuildTag: suse/tomcat:10-%RELEASE% | ||
#!BuildTag: suse/tomcat:%%tomcat_version%% | ||
#!BuildTag: suse/tomcat:%%tomcat_version%%-%RELEASE% | ||
#!BuildTag: suse/tomcat:%%tomcat_minor%% | ||
#!BuildTag: suse/tomcat:%%tomcat_minor%%-%RELEASE% | ||
#!BuildName: suse-tomcat-10 | ||
#!BuildVersion: 15.6.10 | ||
FROM suse/sle15:15.6 | ||
|
||
MAINTAINER SUSE LLC (https://www.suse.com/) | ||
|
||
# Define labels according to https://en.opensuse.org/Building_derived_containers | ||
# labelprefix=com.suse.application.tomcat | ||
LABEL org.opencontainers.image.title="SLE Apache Tomcat 10" | ||
LABEL org.opencontainers.image.description="Apache Tomcat 10 container based on the SLE Base Container Image." | ||
LABEL org.opencontainers.image.version="10" | ||
LABEL org.opencontainers.image.url="https://www.suse.com/products/base-container-images/" | ||
LABEL org.opencontainers.image.created="%BUILDTIME%" | ||
LABEL org.opencontainers.image.vendor="SUSE LLC" | ||
LABEL org.opencontainers.image.source="%SOURCEURL%" | ||
LABEL io.artifacthub.package.readme-url="%SOURCEURL%/README.md" | ||
LABEL io.artifacthub.package.logo-url="https://tomcat.apache.org/res/images/tomcat.png" | ||
LABEL org.opensuse.reference="registry.suse.com/suse/tomcat:10-%RELEASE%" | ||
LABEL org.openbuildservice.disturl="%DISTURL%" | ||
LABEL com.suse.supportlevel="techpreview" | ||
LABEL com.suse.eula="sle-bci" | ||
LABEL com.suse.lifecycle-url="https://www.suse.com/lifecycle#suse-linux-enterprise-server-15" | ||
LABEL com.suse.release-stage="beta" | ||
# endlabelprefix | ||
|
||
RUN set -euo pipefail; zypper -n in --no-recommends tomcat10; zypper -n clean; rm -rf /var/log/* | ||
ENV TOMCAT_MAJOR="10" | ||
ENV TOMCAT_VERSION="%%tomcat_version%%" | ||
ENV CATALINA_HOME="/usr/share/tomcat" | ||
ENV CATALINA_BASE="/usr/share/tomcat" | ||
ENV PATH="/usr/share/tomcat/bin:$PATH" | ||
|
||
CMD ["/usr/lib/tomcat/server", "start"] | ||
EXPOSE 8080 | ||
RUN set -euo pipefail; mkdir -p /var/log/tomcat; chown --recursive tomcat:tomcat /var/log/tomcat; | ||
RUN set -euo pipefail; \ | ||
sed -i /etc/tomcat/logging.properties \ | ||
-e 's|org\.apache\.catalina\.core\.ContainerBase\.\[Catalina\]\.\[localhost\]\.handlers =.*|org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers = java.util.logging.ConsoleHandler|' \ | ||
-e 's|org\.apache\.catalina\.core\.ContainerBase\.\[Catalina\]\.\[localhost\]\.\[/manager\]\.handlers =.*|org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].handlers = java.util.logging.ConsoleHandler|' \ | ||
-e 's|org\.apache\.catalina\.core\.ContainerBase\.\[Catalina\]\.\[localhost\]\.\[/host-manager\]\.handlers =.*|org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].handlers = java.util.logging.ConsoleHandler|' | ||
|
||
WORKDIR $CATALINA_HOME | ||
USER tomcat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# Tomcat 10 Container Image | ||
| ||
Apache Tomcat (Tomcat for short) is a free and open-source implementation of the | ||
Jakarta Servlet, Jakarta Expression Language, and WebSocket technologies. It | ||
provides a pure Java HTTP web server environment that can run Java code. It is a | ||
Java web application server and not a complete JEE application server. | ||
| ||
| ||
## How to use the image | ||
| ||
By default, the image launches Tomcat with the same configuration as the one | ||
that comes with SUSE Linux Enterprise Server. The difference is that logging is | ||
sent to stdout, meaning that the `podman logs tomcat` command displays Tomcat | ||
logs. | ||
| ||
For security reasons, the image runs as the **tomcat** user. This means that | ||
additional packages cannot be installed via `zypper`, unless the user becomes | ||
`root`. | ||
| ||
To deploy an application, copy the `.war` file file into | ||
`$CATALINA_BASE/webapps` (either during a container build or by bind-mounting | ||
the directory), and launch the container using the following command: | ||
```ShellSession | ||
$ podman run -d --rm -p 8080:8080 registry.suse.com/suse/tomcat:10 | ||
``` | ||
| ||
The deployed webapp is then accessible via `http://localhost:8080/$webapp_name`. | ||
| ||
|
||
### How to use the image with rootless Podman | ||
|
||
The container image can be used in rootless mode with Podman. Keep in mind that | ||
Podman remaps the `tomcat` user in the container to a different user on the | ||
host. This user will not have write access to the mounted directory. To avoid | ||
permission issues change permissions of the shared directory to `0777` as | ||
follows: | ||
|
||
```ShellSession | ||
$ chmod 0777 /path/to/my/app | ||
$ podman run --rm -d -v /path/to/my/app:/usr/share/tomcat/webapps:z \ | ||
-p 8080:8080 registry.suse.com/suse/tomcat:10 | ||
``` | ||
| ||
|
||
## Configuration | ||
| ||
The main Tomcat configuration files (for example | ||
`/etc/tomcat/logging.properties`) are stored in `/etc/tomcat/`. | ||
| ||
Tomcat's runtime options can be configured using the environment variables | ||
`JAVA_OPTS` and `CATALINA_OPTS`. `JAVA_OPTS` specifies general options used for | ||
the JVM, whereas `CATALINA_OPTS` specifies Tomcat's flags. You can pass the | ||
options to the container runtime using the `-e` flag: | ||
```ShellSession | ||
$ podman run -it --rm \ | ||
-e JAVA_OPTS="-Xmx1024m" \ | ||
-p 8080:8080 \ | ||
registry.suse.com/suse/tomcat:10 | ||
``` | ||
| ||
The image ships with `CATALINA_HOME` set to `/usr/share/tomcat` and `CATALINA_BASE` set to | ||
`/usr/share/tomcat`. | ||
| ||
| ||
## Samples | ||
| ||
By default, the sample applications shipped with Tomcat are not installed in | ||
the container image. You can obtain them by installing one of the following | ||
packages: | ||
- tomcat10-webapps | ||
- tomcat10-admin-webapps | ||
- tomcat10-docs-webapp | ||
|
||
|
||
## Upgrading from Tomcat 9 | ||
| ||
Tomcat 9 implements Java EE 8, and Tomcat 10 implements Jakarta | ||
EE 9. Before upgrading from version 9, consult the upstream migration guide: | ||
https://tomcat.apache.org/migration-10.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<services> | ||
<service mode="buildtime" name="docker_label_helper"/> | ||
<service mode="buildtime" name="kiwi_metainfo_helper"/> | ||
<service name="replace_using_package_version" mode="buildtime"> | ||
<param name="file">Dockerfile</param> | ||
<param name="regex">%%tomcat_version%%</param> | ||
<param name="package">tomcat10</param> | ||
</service> | ||
<service name="replace_using_package_version" mode="buildtime"> | ||
<param name="file">Dockerfile</param> | ||
<param name="regex">%%tomcat_minor%%</param> | ||
<param name="package">tomcat10</param> | ||
<param name="parse-version">minor</param> | ||
</service> | ||
</services> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
------------------------------------------------------------------- | ||
Fri Mar 08 11:05:28 UTC 2024 - SUSE Update Bot <[email protected]> | ||
|
||
- First version of the Apache Tomcat 10 BCI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# SPDX-License-Identifier: MIT | ||
|
||
# Copyright (c) 2024 SUSE LLC | ||
|
||
# All modifications and additions to the file contributed by third parties | ||
# remain the property of their copyright owners, unless otherwise agreed | ||
# upon. | ||
|
||
# The content of THIS FILE IS AUTOGENERATED and should not be manually modified. | ||
# It is maintained by the BCI team and generated by | ||
# https://github.com/SUSE/BCI-dockerfile-generator | ||
|
||
# Please submit bugfixes or comments via https://bugs.opensuse.org/ | ||
# You can contact the BCI team via https://github.com/SUSE/bci/discussions | ||
|
||
|
||
#!BuildTag: suse/tomcat:9 | ||
#!BuildTag: suse/tomcat:9-%RELEASE% | ||
#!BuildTag: suse/tomcat:%%tomcat_version%% | ||
#!BuildTag: suse/tomcat:%%tomcat_version%%-%RELEASE% | ||
#!BuildTag: suse/tomcat:%%tomcat_minor%% | ||
#!BuildTag: suse/tomcat:%%tomcat_minor%%-%RELEASE% | ||
#!BuildName: suse-tomcat-9 | ||
#!BuildVersion: 15.6.9 | ||
FROM suse/sle15:15.6 | ||
|
||
MAINTAINER SUSE LLC (https://www.suse.com/) | ||
|
||
# Define labels according to https://en.opensuse.org/Building_derived_containers | ||
# labelprefix=com.suse.application.tomcat | ||
LABEL org.opencontainers.image.title="SLE Apache Tomcat 9" | ||
LABEL org.opencontainers.image.description="Apache Tomcat 9 container based on the SLE Base Container Image." | ||
LABEL org.opencontainers.image.version="9" | ||
LABEL org.opencontainers.image.url="https://www.suse.com/products/base-container-images/" | ||
LABEL org.opencontainers.image.created="%BUILDTIME%" | ||
LABEL org.opencontainers.image.vendor="SUSE LLC" | ||
LABEL org.opencontainers.image.source="%SOURCEURL%" | ||
LABEL io.artifacthub.package.readme-url="%SOURCEURL%/README.md" | ||
LABEL io.artifacthub.package.logo-url="https://tomcat.apache.org/res/images/tomcat.png" | ||
LABEL org.opensuse.reference="registry.suse.com/suse/tomcat:9-%RELEASE%" | ||
LABEL org.openbuildservice.disturl="%DISTURL%" | ||
LABEL com.suse.supportlevel="techpreview" | ||
LABEL com.suse.eula="sle-bci" | ||
LABEL com.suse.lifecycle-url="https://www.suse.com/lifecycle#suse-linux-enterprise-server-15" | ||
LABEL com.suse.release-stage="beta" | ||
# endlabelprefix | ||
|
||
RUN set -euo pipefail; zypper -n in --no-recommends tomcat; zypper -n clean; rm -rf /var/log/* | ||
ENV TOMCAT_MAJOR="9" | ||
ENV TOMCAT_VERSION="%%tomcat_version%%" | ||
ENV CATALINA_HOME="/usr/share/tomcat" | ||
ENV CATALINA_BASE="/usr/share/tomcat" | ||
ENV PATH="/usr/share/tomcat/bin:$PATH" | ||
|
||
CMD ["/usr/lib/tomcat/server", "start"] | ||
EXPOSE 8080 | ||
RUN set -euo pipefail; mkdir -p /var/log/tomcat; chown --recursive tomcat:tomcat /var/log/tomcat; | ||
RUN set -euo pipefail; \ | ||
sed -i /etc/tomcat/logging.properties \ | ||
-e 's|org\.apache\.catalina\.core\.ContainerBase\.\[Catalina\]\.\[localhost\]\.handlers =.*|org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers = java.util.logging.ConsoleHandler|' \ | ||
-e 's|org\.apache\.catalina\.core\.ContainerBase\.\[Catalina\]\.\[localhost\]\.\[/manager\]\.handlers =.*|org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].handlers = java.util.logging.ConsoleHandler|' \ | ||
-e 's|org\.apache\.catalina\.core\.ContainerBase\.\[Catalina\]\.\[localhost\]\.\[/host-manager\]\.handlers =.*|org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].handlers = java.util.logging.ConsoleHandler|' | ||
|
||
WORKDIR $CATALINA_HOME | ||
USER tomcat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# Tomcat 9 Container Image | ||
| ||
Apache Tomcat (Tomcat for short) is a free and open-source implementation of the | ||
Jakarta Servlet, Jakarta Expression Language, and WebSocket technologies. It | ||
provides a pure Java HTTP web server environment that can run Java code. It is a | ||
Java web application server and not a complete JEE application server. | ||
| ||
| ||
## How to use the image | ||
| ||
By default, the image launches Tomcat with the same configuration as the one | ||
that comes with SUSE Linux Enterprise Server. The difference is that logging is | ||
sent to stdout, meaning that the `podman logs tomcat` command displays Tomcat | ||
logs. | ||
| ||
For security reasons, the image runs as the **tomcat** user. This means that | ||
additional packages cannot be installed via `zypper`, unless the user becomes | ||
`root`. | ||
| ||
To deploy an application, copy the `.war` file file into | ||
`$CATALINA_BASE/webapps` (either during a container build or by bind-mounting | ||
the directory), and launch the container using the following command: | ||
```ShellSession | ||
$ podman run -d --rm -p 8080:8080 registry.suse.com/suse/tomcat:9 | ||
``` | ||
| ||
The deployed webapp is then accessible via `http://localhost:8080/$webapp_name`. | ||
| ||
|
||
### How to use the image with rootless Podman | ||
|
||
The container image can be used in rootless mode with Podman. Keep in mind that | ||
Podman remaps the `tomcat` user in the container to a different user on the | ||
host. This user will not have write access to the mounted directory. To avoid | ||
permission issues change permissions of the shared directory to `0777` as | ||
follows: | ||
|
||
```ShellSession | ||
$ chmod 0777 /path/to/my/app | ||
$ podman run --rm -d -v /path/to/my/app:/usr/share/tomcat/webapps:z \ | ||
-p 8080:8080 registry.suse.com/suse/tomcat:9 | ||
``` | ||
| ||
|
||
## Configuration | ||
| ||
The main Tomcat configuration files (for example | ||
`/etc/tomcat/logging.properties`) are stored in `/etc/tomcat/`. | ||
| ||
Tomcat's runtime options can be configured using the environment variables | ||
`JAVA_OPTS` and `CATALINA_OPTS`. `JAVA_OPTS` specifies general options used for | ||
the JVM, whereas `CATALINA_OPTS` specifies Tomcat's flags. You can pass the | ||
options to the container runtime using the `-e` flag: | ||
```ShellSession | ||
$ podman run -it --rm \ | ||
-e JAVA_OPTS="-Xmx1024m" \ | ||
-p 8080:8080 \ | ||
registry.suse.com/suse/tomcat:9 | ||
``` | ||
| ||
The image ships with `CATALINA_HOME` set to `/usr/share/tomcat` and `CATALINA_BASE` set to | ||
`/usr/share/tomcat`. | ||
| ||
| ||
## Samples | ||
| ||
By default, the sample applications shipped with Tomcat are not installed in | ||
the container image. You can obtain them by installing one of the following | ||
packages: | ||
- tomcat-webapps | ||
- tomcat-admin-webapps | ||
- tomcat-docs-webapp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<services> | ||
<service mode="buildtime" name="docker_label_helper"/> | ||
<service mode="buildtime" name="kiwi_metainfo_helper"/> | ||
<service name="replace_using_package_version" mode="buildtime"> | ||
<param name="file">Dockerfile</param> | ||
<param name="regex">%%tomcat_version%%</param> | ||
<param name="package">tomcat</param> | ||
</service> | ||
<service name="replace_using_package_version" mode="buildtime"> | ||
<param name="file">Dockerfile</param> | ||
<param name="regex">%%tomcat_minor%%</param> | ||
<param name="package">tomcat</param> | ||
<param name="parse-version">minor</param> | ||
</service> | ||
</services> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
------------------------------------------------------------------- | ||
Fri Mar 08 11:05:28 UTC 2024 - SUSE Update Bot <[email protected]> | ||
|
||
- First version of the Apache Tomcat 9 BCI |