Last active
November 10, 2023 08:31
-
-
Save karlhillx/9209ca8e319594888e800bc59a7d0d39 to your computer and use it in GitHub Desktop.
Dockerfile to run Tomcat 9 in the latest Ubuntu container
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
# Docker file for Ubuntu with OpenJDK 18 and Tomcat 9. | |
FROM ubuntu:latest | |
LABEL maintainer="Karl Hill <karl.hill@nasa.gov>" | |
# Set environment variables | |
ENV TOMCAT_VERSION 9.0.71 | |
ENV CATALINA_HOME /usr/local/tomcat | |
ENV JAVA_HOME /usr/lib/jvm/java-18-openjdk-amd64 | |
ENV PATH $CATALINA_HOME/bin:$PATH | |
# Install JDK & wget packages. | |
RUN apt-get -y update && apt-get -y upgrade | |
RUN apt-get -y install openjdk-18-jdk wget | |
# Install and configure Tomcat. | |
RUN mkdir $CATALINA_HOME | |
RUN wget https://archive.apache.org/dist/tomcat/tomcat-9/v${TOMCAT_VERSION}/bin/apache-tomcat-${TOMCAT_VERSION}.tar.gz -O /tmp/tomcat.tar.gz | |
RUN cd /tmp && tar xvfz tomcat.tar.gz | |
RUN cp -Rv /tmp/apache-tomcat-${TOMCAT_VERSION}/* $CATALINA_HOME | |
RUN rm -rf /tmp/apache-tomcat-${TOMCAT_VERSION} | |
RUN rm -rf /tmp/tomcat.tar.gz | |
# Expose Tomcat port. | |
EXPOSE 80 | |
# Start Tomcat | |
CMD ["/usr/local/tomcat/bin/catalina.sh", "run"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment