Skip to content

Instantly share code, notes, and snippets.

@spara
Created January 11, 2018 21:59
Show Gist options
  • Save spara/539506587799960b12f2f014ae573cee to your computer and use it in GitHub Desktop.
Save spara/539506587799960b12f2f014ae573cee to your computer and use it in GitHub Desktop.
FROM registry.access.redhat.com/rhel7/rhel
# Register container to access repositories
RUN subscription-manager register --username lenswipe2000 --password docker4thewin! --auto-attach
RUN yum-config-manager --disable rhel-7-server-rt-beta-rpms
# Install prepare infrastructure
RUN yum -y update && \
yum -y install wget && \
yum -y install tar
# Prepare environment
ENV JAVA_HOME /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.161-2.6.12.0.el7_4.x86_64/jre
ENV CATALINA_HOME /opt/tomcat
ENV PATH $PATH:$JAVA_HOME/bin:$CATALINA_HOME/bin:$CATALINA_HOME/scripts
# Install OpenJDK 7 JRE
RUN yum -y install java-1.7.0-openjdk
# Install Tomcat
RUN wget http://mirrors.koehn.com/apache/tomcat/tomcat-7/v7.0.82/bin/apache-tomcat-7.0.82.tar.gz && \
tar -xvf apache-tomcat-7.0.82.tar.gz && \
rm apache-tomcat*.tar.gz && \
mv apache-tomcat* ${CATALINA_HOME} && \
chmod +x ${CATALINA_HOME}/bin/*.sh
# Configure admin user
RUN sed -i '$i<user username="admin" password="password" roles="manager-gui,admin-gui"/>' /opt/tomcat/conf/tomcat-users.xml
# Configure startup script
RUN touch /opt/tomcat/bin/run.sh && \
echo '#!/bin/bash' > /opt/tomcat/bin/run.sh && \
echo 'exec /opt/tomcat/bin/catalina.sh run' >> /opt/tomcat/bin/run.sh && \
chmod 755 /opt/tomcat/bin/run.sh
# Open ports
EXPOSE 8080
EXPOSE 8009
CMD ["/opt/tomcat/bin/run.sh"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment