Skip to content

Commit

Permalink
Change tomcat version, catalina_opts
Browse files Browse the repository at this point in the history
  • Loading branch information
mrauhala committed Jan 8, 2024
1 parent 74b6039 commit 1adbd8a
Showing 1 changed file with 37 additions and 13 deletions.
50 changes: 37 additions & 13 deletions 2.22/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG TOMCAT_VERSION="9"
ARG TOMCAT_VERSION="9-jre17"

FROM docker.io/tomcat:$TOMCAT_VERSION
LABEL maintainer "Mikko Rauhala <mikko@meteo.fi>"
Expand All @@ -14,9 +14,21 @@ ENV GEOSERVER_FONTS=${GEOSERVER_FONTS} \
GEOSERVER_PLUGINS=${GEOSERVER_PLUGINS} \
GEOSERVER_NODE_OPTS='id:$host_name' \
GEOWEBCACHE_CACHE_DIR='/data/gwc' \
JAVA_OPTS="-Xms128m -XX:SoftRefLRUPolicyMSPerMB=36000 -XX:+UseG1GC" \
UMASK=002

# JAVA_OPTS="-Xms128m -XX:SoftRefLRUPolicyMSPerMB=36000 -XX:+UseG1GC" \

# see https://docs.geoserver.org/stable/en/user/production/container.html
ENV CATALINA_OPTS="-Xms256m -Xmx1g \
-Djava.awt.headless=true -server \
-Dfile.encoding=UTF-8 \
-Djavax.servlet.request.encoding=UTF-8 \
-Djavax.servlet.response.encoding=UTF-8 \
-D-XX:SoftRefLRUPolicyMSPerMB=36000 \
-Xbootclasspath/a:$CATALINA_HOME/lib/marlin.jar \
-Dsun.java2d.renderer=sun.java2d.marlin.DMarlinRenderingEngine \
-Dorg.geotools.coverage.jaiext.enabled=true"

# persistent / runtime deps
RUN apt-get update && apt-get install -y --no-install-recommends libnetcdf-c++4 curl unzip && rm -r /var/lib/apt/lists/*

Expand All @@ -31,16 +43,22 @@ RUN \
done

# Install GeoServer
RUN curl -sS -L -O https://sourceforge.net/projects/geoserver/files/GeoServer/$GEOSERVER_VERSION/geoserver-$GEOSERVER_VERSION-war.zip && \
unzip -d $CATALINA_HOME/webapps/ geoserver-$GEOSERVER_VERSION-war.zip geoserver.war && \
unzip -d $CATALINA_HOME/webapps/geoserver $CATALINA_HOME/webapps/geoserver.war && \
rm geoserver-$GEOSERVER_VERSION-war.zip $CATALINA_HOME/webapps/geoserver.war && \
rm -rf $CATALINA_HOME/webapps/geoserver/data/workspaces/tiger $CATALINA_HOME/webapps/geoserver/data/workspaces/nurc $CATALINA_HOME/webapps/geoserver/data/workspaces/sf $CATALINA_HOME/webapps/geoserver/data/workspaces/topp $CATALINA_HOME/webapps/geoserver/data/layergroups/* && \
mkdir -p $GEOSERVER_DATA_DIR $GEOWEBCACHE_CACHE_DIR && \
mv $CATALINA_HOME/webapps/geoserver/data/* $GEOSERVER_DATA_DIR && \
sed -e 's/>PARTIAL-BUFFER2</>SPEED</g' -i $CATALINA_HOME/webapps/geoserver/WEB-INF/web.xml && \
chgrp -R 0 $CATALINA_HOME $GEOWEBCACHE_CACHE_DIR $GEOSERVER_DATA_DIR && \
RUN <<EOT bash
curl -sS -L -O https://sourceforge.net/projects/geoserver/files/GeoServer/$GEOSERVER_VERSION/geoserver-$GEOSERVER_VERSION-war.zip
unzip -d $CATALINA_HOME/webapps/ geoserver-$GEOSERVER_VERSION-war.zip geoserver.war
unzip -d $CATALINA_HOME/webapps/geoserver $CATALINA_HOME/webapps/geoserver.war
rm geoserver-$GEOSERVER_VERSION-war.zip $CATALINA_HOME/webapps/geoserver.war
mv $CATALINA_HOME/webapps/geoserver/WEB-INF/lib/marlin-*.jar $CATALINA_HOME/lib/marlin.jar
rm -rf $CATALINA_HOME/webapps/geoserver/data/workspaces/{tiger,nurc,sf,topp,cite,sde}
rm -rf $CATALINA_HOME/webapps/geoserver/data/data/{nyc,sf,shapefiles,taz_shapes}
rm -rf $CATALINA_HOME/webapps/geoserver/data/{layergroups,coverages}/*
rm -rf $CATALINA_HOME/webapps/geoserver/data/styles/tiger_*
mkdir -p $GEOSERVER_DATA_DIR $GEOWEBCACHE_CACHE_DIR
mv $CATALINA_HOME/webapps/geoserver/data/* $GEOSERVER_DATA_DIR
sed -e 's/>PARTIAL-BUFFER2</>SPEED</g' -i $CATALINA_HOME/webapps/geoserver/WEB-INF/web.xml
chgrp -R 0 $CATALINA_HOME $GEOWEBCACHE_CACHE_DIR $GEOSERVER_DATA_DIR
chmod -R g=u $CATALINA_HOME $GEOWEBCACHE_CACHE_DIR $GEOSERVER_DATA_DIR
EOT

# Install GeoServer Plugins
RUN for PLUGIN in ${GEOSERVER_PLUGINS}; \
Expand All @@ -56,8 +74,6 @@ EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=10s\
CMD curl -f "http://localhost:8080/geoserver/ows?service=wms&version=1.3.0&request=GetCapabilities" || exit 1

#COPY server.xml $CATALINA_HOME/conf/

# Enable CORS
RUN sed -i '\:</web-app>:i \
<filter>\n \
Expand All @@ -75,6 +91,14 @@ RUN sed -i '\:</web-app>:i \

RUN chmod -R g=u /etc/passwd /var/log

COPY <<-EOT $CATALINA_HOME/webapps/ROOT/index.jsp
<%
final String redirectURL = "/geoserver/web/";
response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
response.setHeader("Location", redirectURL);
%>
EOT

COPY docker-entrypoint.sh first-run-config.sh /

### Containers should NOT run as root as a good practice
Expand Down

0 comments on commit 1adbd8a

Please sign in to comment.