Created
January 8, 2021 22:28
-
-
Save dalmosantos/ca0973c3322209e8a0ce5758b547f254 to your computer and use it in GitHub Desktop.
Docker CentOS-7 - Apache Tomcat 8.5
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
#==================================== | |
# CentOS Linux - Apache Tomcat 8.5 | |
#==================================== | |
FROM openjdk:8u275-jdk-centos7.9 | |
ENV TOMCAT_VERSION=8.5.61 \ | |
TOMCAT_MAJOR=8 \ | |
TOMCAT_DISPLAY_VERSION=8.5 \ | |
CATALINA_HOME=/opt/tomcat \ | |
JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8 | |
ENV PATH $CATALINA_HOME/bin:$PATH | |
RUN mkdir -p ${CATALINA_HOME} && \ | |
cd ${CATALINA_HOME} && \ | |
curl -LfsS https://www.apache.org/dist/tomcat/tomcat-$TOMCAT_MAJOR/v$TOMCAT_VERSION/bin/apache-tomcat-$TOMCAT_VERSION.tar.gz -o /tmp/apache-tomcat-$TOMCAT_VERSION.tar.gz && \ | |
ls -ltra /tmp && \ | |
tar -xvf /tmp/apache-tomcat-$TOMCAT_VERSION.tar.gz --strip-components=1 -C ${CATALINA_HOME} && \ | |
chmod +x ${CATALINA_HOME}/bin/*sh && \ | |
chmod -R +rX . && \ | |
chmod 777 ${CATALINA_HOME}/{logs,temp,work} && \ | |
# Tomcat admin user | |
chown -R 1001:0 ${CATALINA_HOME} && \ | |
chmod -R ug+rwx ${CATALINA_HOME} | |
# Create tomcat user | |
# groupadd -r tomcat && \ | |
# useradd -g tomcat -d ${CATALINA_HOME} -s /sbin/nologin -c "Tomcat user" tomcat && \ | |
# chown -R tomcat:tomcat ${CATALINA_HOME} | |
WORKDIR ${CATALINA_HOME} | |
EXPOSE 8080 8005 8009 8443 | |
USER 1001 | |
CMD ["catalina.sh", "run"] |
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
#==================================== | |
# CentOS Linux - AdoptOpenJDK 8 | |
#==================================== | |
FROM centos:centos7.9.2009 | |
#Set language | |
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8' | |
# User root user to install software | |
USER root | |
# Install Essentials | |
RUN yum repolist && \ | |
yum update -y && \ | |
yum install -y epel-release && \ | |
yum install --setopt=tsflags=nodocs -y yum-utils gettext openssl curl tzdata fontconfig \ | |
ca-certificates unzip jq net-tools && \ | |
# Install AdoptOpenJDK | |
ESUM='06fb04075ed503013beb12ab87963b2ca36abe9e397a0c298a57c1d822467c29'; \ | |
BINARY_URL='https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u275-b01/OpenJDK8U-jdk_x64_linux_hotspot_8u275b01.tar.gz'; \ | |
curl -LfsSo /tmp/openjdk.tar.gz ${BINARY_URL}; \ | |
echo "${ESUM} */tmp/openjdk.tar.gz" | sha256sum -c -; \ | |
mkdir -p /opt/java/openjdk; \ | |
cd /opt/java/openjdk; \ | |
tar -xf /tmp/openjdk.tar.gz --strip-components=1; \ | |
ln -s /usr/lib/jvm /opt/java/openjdk && \ | |
# Clean packages and disable yum repo | |
yum remove `package-cleanup --leaves` && \ | |
yum clean all && \ | |
yum-config-manager --disable \* && \ | |
rm -rf /var/lib/yum/yumdb && \ | |
rm -rf /var/lib/yum/history && \ | |
rm -rf /var/cache/yum /tmp/* /var/log/*log | |
# Set the JAVA_HOME variable to make it clear where Java is located | |
ENV JAVA_HOME=/opt/java/openjdk \ | |
PATH="/opt/java/openjdk/bin:$PATH" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment