docker-ahi/tomcat/Dockerfile
2025-12-11 16:08:19 +01:00

53 lines
2.1 KiB
Docker

FROM tomcat:9.0.111-jdk17
# Define arguments for the group and user IDs
ARG USER_ID
ARG GROUP_ID
ARG USERNAME
ARG GROUPNAME
# Create group and user with IDs passed from Docker Compose
RUN groupadd -g ${GROUP_ID} ${GROUPNAME} && useradd --no-log-init -u ${USER_ID} -g ${GROUP_ID} -m ${USERNAME} || true
# SUPPORTO A VERSIONI VECCHIE DI SQL SERVER (ERRORI SSL)
# Check if java.security exists at the correct path and remove any disabled algorithms
# RUN if [ -f /opt/java/openjdk/conf/security/java.security ]; then sed -i '/jdk.tls.disabledAlgorithms/d' /opt/java/openjdk/conf/security/java.security; else echo "java.security file not found"; fi
# Networking tools + MS core fonts (Times New Roman) in one layer
RUN set -eux; \
# Enable contrib/non-free (needed for ttf-mscorefonts-installer on Debian)
sed -ri 's/^deb (.*) main$/deb \1 main contrib non-free non-free-firmware/' /etc/apt/sources.list || true; \
apt-get update; \
apt-get install -y --no-install-recommends \
iputils-ping inetutils-telnet dnsutils net-tools curl wget traceroute tcpdump nmap iproute2 \
openssl ca-certificates gnupg \
fontconfig cabextract xfonts-utils debconf; \
echo "ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true" | debconf-set-selections; \
apt-get install -y --no-install-recommends ttf-mscorefonts-installer; \
fc-cache -fv; \
rm -rf /var/lib/apt/lists/*
# SOLO SE RICHIESTO PER infinity dms converter
#RUN apt-get install libreoffice
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# CONFIG
COPY ./conf/catalina.properties /usr/local/tomcat/conf/catalina.properties
COPY ./conf/context.xml /usr/local/tomcat/conf/context.xml
COPY ./conf/server.xml /usr/local/tomcat/conf/server.xml
# Librerie
COPY ./libs/ /usr/local/tomcat/lib/
# Set permissions on Tomcat directories
RUN chown -R ${USERNAME}:${GROUPNAME} /usr/local/tomcat
# Ensure the required dconf cache directory exists and has the correct permissions (per libreoffice)
#RUN mkdir -p /home/${USERNAME}/.cache/dconf && \
# chown -R ${USERNAME}:${GROUPNAME} /home/${USERNAME}/.cache/dconf
USER ${USERNAME}
CMD ["catalina.sh", "run"]