Skip to content

Instantly share code, notes, and snippets.

@ghusta
Last active August 12, 2022 20:39
Show Gist options
  • Save ghusta/12b50687a39bd02a88680df450a840f4 to your computer and use it in GitHub Desktop.
Save ghusta/12b50687a39bd02a88680df450a840f4 to your computer and use it in GitHub Desktop.
Tomcat 8 + Docker : add custom directory in classpath (Method #1 : modify conf/catalina.properties)
FROM tomcat:8.5-jre8
# $CATALINA_HOME is defined in tomcat image
ADD target/my-webapp*.war $CATALINA_HOME/webapps/my-webapp.war
# Application config
RUN mkdir $CATALINA_HOME/app_conf/
ADD src/main/config/test.properties $CATALINA_HOME/app_conf/
# Modify property 'shared.loader' in catalina.properties
RUN sed -i -e 's/^shared.loader=$/shared.loader="${catalina.base}\/app_conf"/' $CATALINA_HOME/conf/catalina.properties
# Check : docker exec my-webapp cat /usr/local/tomcat/conf/catalina.properties
@Pozo
Copy link

Pozo commented Aug 19, 2019

Thanks for the gist. It's working perfectly.

@ghusta
Copy link
Author

ghusta commented Aug 20, 2019

Thanks !

@macharya1216
Copy link

Thank you for this. Saved me a lot of time!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment