# 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

#!ExclusiveArch: aarch64 x86_64
#!BuildTag: containers/apache-tomcat:10-jre21
#!BuildTag: containers/apache-tomcat:10-jre21-%RELEASE%
#!BuildTag: containers/apache-tomcat:%%tomcat_version%%-jre21
#!BuildTag: containers/apache-tomcat:%%tomcat_version%%-jre21-%RELEASE%
#!BuildTag: containers/apache-tomcat:%%tomcat_minor%%-jre21
#!BuildTag: containers/apache-tomcat:%%tomcat_minor%%-jre21-%RELEASE%
#!BuildName: containers-apache-tomcat-10-jre21
#!BuildVersion: 15.6
#!BuildRelease: 35
FROM suse/sle15:15.6

# Define labels according to https://en.opensuse.org/Building_derived_containers
# labelprefix=com.suse.application.apache-tomcat
LABEL org.opencontainers.image.authors="SUSE LLC (https://www.suse.com/)"
LABEL org.opencontainers.image.title="Apache Tomcat"
LABEL org.opencontainers.image.description="Apache Tomcat container based on the SLE Base Container Image."
LABEL org.opencontainers.image.version="10-jre21"
LABEL org.opencontainers.image.url="https://apps.rancher.io/applications/apache-tomcat"
LABEL org.opencontainers.image.created="%BUILDTIME%"
LABEL org.opencontainers.image.vendor="SUSE LLC"
LABEL org.opencontainers.image.source="%SOURCEURL%"
LABEL org.opensuse.reference="dp.apps.rancher.io/containers/apache-tomcat:10-jre21-%RELEASE%"
LABEL org.openbuildservice.disturl="%DISTURL%"
LABEL com.suse.supportlevel="techpreview"
LABEL com.suse.supportlevel.until="2027-07-01"
LABEL com.suse.eula="sle-eula"
LABEL com.suse.lifecycle-url="https://www.suse.com/lifecycle#suse-linux-enterprise-server-15"
LABEL com.suse.release-stage="released"
# endlabelprefix
LABEL io.artifacthub.package.readme-url="%SOURCEURL%/README.md"
LABEL io.artifacthub.package.logo-url="https://tomcat.apache.org/res/images/tomcat.png"

RUN set -euo pipefail; zypper -n in --no-recommends tomcat10 java-21-openjdk java-21-openjdk-headless; zypper -n clean; rm -rf /var/log/{lastlog,tallylog,zypper.log,zypp/history,YaST2}
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
