#!/bin/sh ## install GeoServer extensions before starting the tomcat /opt/install-extensions.sh # copy additional geoserver libs before starting the tomcat # we also count whether at least one file with the extensions exists count=`ls -1 $ADDITIONAL_LIBS_DIR/*.jar 2>/dev/null | wc -l` if [ -d "$ADDITIONAL_LIBS_DIR" ] && [ $count != 0 ]; then cp $ADDITIONAL_LIBS_DIR/*.jar $CATALINA_HOME/webapps/geoserver/WEB-INF/lib/ fi # copy additional fonts before starting the tomcat # we also count whether at least one file with the extensions exists count=`ls -1 *.ttf 2>/dev/null | wc -l` if [ -d "$ADDITIONAL_FONTS_DIR" ] && [ $count != 0 ]; then cp $ADDITIONAL_FONTS_DIR/*.ttf /usr/share/fonts/truetype/ fi # configure CORS (inspired by https://github.com/oscarfonts/docker-geoserver) # if enabled, this will add the filter definitions # to the end of the web.xml # (this will only happen if our filter has not yet been added before) if [ "${CORS_ENABLED}" = "true" ]; then if ! grep -q DockerGeoServerCorsFilter "$CATALINA_HOME/webapps/geoserver/WEB-INF/web.xml"; then sed -i "\::i\\ \n\ DockerGeoServerCorsFilter\n\ org.apache.catalina.filters.CorsFilter\n\ \n\ cors.allowed.origins\n\ ${CORS_ALLOWED_ORIGINS}\n\ \n\ \n\ cors.allowed.methods\n\ ${CORS_ALLOWED_METHODS}\n\ \n\ \n\ cors.allowed.headers\n\ ${CORS_ALLOWED_HEADERS}\n\ \n\ \n\ \n\ DockerGeoServerCorsFilter\n\ /*\n\ " "$CATALINA_HOME/webapps/geoserver/WEB-INF/web.xml"; fi fi # start the tomcat $CATALINA_HOME/bin/catalina.sh run