759f27dabf
OBS-URL: https://build.opensuse.org/package/show/devel:BCI:Tumbleweed/apache-tomcat-9-image?expand=0&rev=268
85 lines
4.5 KiB
Docker
85 lines
4.5 KiB
Docker
# SPDX-License-Identifier: MIT
|
|
|
|
# Copyright (c) 2026 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
|
|
|
|
#!UseOBSRepositories
|
|
|
|
#!BuildTag: opensuse/apache-tomcat:%%tomcat_version%%-openjdk17-%RELEASE%
|
|
#!BuildTag: opensuse/apache-tomcat:%%tomcat_version%%-openjdk17
|
|
#!BuildTag: opensuse/apache-tomcat:9-openjdk17
|
|
#!BcntSyncTag: apache-tomcat-9-image
|
|
|
|
FROM opensuse/bci/bci-micro:latest AS target
|
|
FROM opensuse/tumbleweed:latest AS builder
|
|
COPY --from=target / /target
|
|
|
|
RUN set -euo pipefail; \
|
|
export PERMCTL_ALLOW_INSECURE_MODE_IF_NO_PROC=1; \
|
|
zypper -n --installroot /target --gpg-auto-import-keys install --no-recommends tomcat java-17-openjdk java-17-openjdk-headless; \
|
|
zypper -n --installroot /target remove util-linux
|
|
|
|
# cleanup logs and temporary files
|
|
RUN set -euo pipefail; zypper -n --installroot /target clean -a; \
|
|
t=$(mktemp -d); mv /target/usr/lib/sysimage/rpm/Packages.db $t; rpmdb --rebuilddb --dbpath=$t; \
|
|
rm /target/usr/lib/sysimage/rpm/*.db && mv $t/Packages.db /target/usr/lib/sysimage/rpm/; \
|
|
rm -rf {/target,}/var/log/{alternatives.log,lastlog,suseconnect.log,tallylog,zypper.log,zypp/history,YaST2}; \
|
|
rm -rf {/target,}/run/{zypp.pid,regenerate-initrd,systemd}; \
|
|
rm -f {/target,}/etc/{shadow-,group-,passwd-,.pwd.lock}; \
|
|
rm -f {/target,}/usr/lib/sysimage/rpm/.rpm.lock; \
|
|
rm -f {/target,}/var/lib/zypp/AnonymousUniqueId; \
|
|
rm -f {/target,}/var/lib/zypp/AutoInstalled; \
|
|
rm -f {/target,}/var/cache/ldconfig/aux-cache
|
|
|
|
# set the day of last password change to empty
|
|
RUN set -euo pipefail; sed -i 's/^\([^:]*:[^:]*:\)[^:]*\(:.*\)$/\1\2/' /target/etc/shadow
|
|
FROM opensuse/bci/bci-micro:latest
|
|
COPY --from=builder /target /
|
|
# Define labels according to https://en.opensuse.org/Building_derived_containers
|
|
# labelprefix=org.opensuse.application.apache-tomcat
|
|
LABEL org.opencontainers.image.title="openSUSE Tumbleweed Apache Tomcat"
|
|
LABEL org.opencontainers.image.description="Apache Tomcat container based on the openSUSE Tumbleweed Base Container Image."
|
|
LABEL org.opencontainers.image.version="%%tomcat_version%%"
|
|
LABEL org.opencontainers.image.url="https://www.opensuse.org"
|
|
LABEL org.opencontainers.image.created="%BUILDTIME%"
|
|
LABEL org.opencontainers.image.vendor="openSUSE Project"
|
|
LABEL org.opencontainers.image.source="%SOURCEURL%"
|
|
LABEL org.opencontainers.image.ref.name="%%tomcat_version%%-openjdk17-%RELEASE%"
|
|
LABEL org.opensuse.reference="registry.opensuse.org/opensuse/apache-tomcat:%%tomcat_version%%-openjdk17-%RELEASE%"
|
|
LABEL org.openbuildservice.disturl="%DISTURL%"
|
|
LABEL org.opensuse.lifecycle-url="https://en.opensuse.org/Lifetime#openSUSE_BCI"
|
|
LABEL org.opensuse.release-stage="released"
|
|
# endlabelprefix
|
|
LABEL io.artifacthub.package.readme-url="%SOURCEURL_WITH(README.openjdk17.md)%"
|
|
LABEL io.artifacthub.package.logo-url="https://tomcat.apache.org/res/images/tomcat.png"
|
|
ENV CATALINA_BASE="/usr/share/tomcat"
|
|
ENV CATALINA_HOME="/usr/share/tomcat"
|
|
ENV PATH="/usr/share/tomcat/bin:$PATH"
|
|
ENV TOMCAT_MAJOR="9"
|
|
ENV TOMCAT_VERSION="%%tomcat_version%%"
|
|
CMD ["/usr/libexec/tomcat/server", "start"]
|
|
EXPOSE 8080/tcp
|
|
RUN set -euo pipefail; mkdir -p /var/log/tomcat; chown --recursive tomcat:tomcat /var/log/tomcat
|
|
RUN set -euo pipefail; ln -s /usr/share/tomcat /usr/local/tomcat
|
|
RUN set -euo pipefail; while IFS= read -r line; do \
|
|
line=${line/org\.apache\.catalina\.core\.ContainerBase\.\[Catalina\]\.\[localhost\]\.handlers =*/org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers = java.util.logging.ConsoleHandler}; \
|
|
line=${line/org\.apache\.catalina\.core\.ContainerBase\.\[Catalina\]\.\[localhost\]\.\[\/manager\]\.handlers =*/org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].handlers = java.util.logging.ConsoleHandler}; \
|
|
line=${line/org\.apache\.catalina\.core\.ContainerBase\.\[Catalina\]\.\[localhost\]\.\[\/host-manager\]\.handlers =*/org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].handlers = java.util.logging.ConsoleHandler}; \
|
|
echo "$line" >> /tmp/logging.properties; \
|
|
done < /usr/share/tomcat/conf/logging.properties; \
|
|
|
|
mv /tmp/logging.properties /usr/share/tomcat/conf/logging.properties
|
|
|
|
WORKDIR $CATALINA_HOME
|
|
USER tomcat
|