-
Notifications
You must be signed in to change notification settings - Fork 51
/
Dockerfile
56 lines (43 loc) · 2.19 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
FROM tomcat:9-jre17
LABEL maintainer="Oscar Fonts <oscar.fonts@geomati.co>"
ENV GEOSERVER_VERSION 2.25.4
ENV GEOSERVER_DATA_DIR /var/local/geoserver
ENV GEOSERVER_INSTALL_DIR /usr/local/geoserver
ENV GEOSERVER_EXT_DIR /var/local/geoserver-exts
ENV GEOSERVER_PATH=/geoserver
# Uncomment to use APT cache (requires apt-cacher-ng on host)
#RUN echo "Acquire::http { Proxy \"http://`/sbin/ip route|awk '/default/ { print $3 }'`:3142\"; };" > /etc/apt/apt.conf.d/71-apt-cacher-ng
# Microsoft fonts
RUN echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections
RUN set -x \
&& apt-get update \
&& apt-get install -yq ttf-mscorefonts-installer unzip \
&& rm -rf /var/lib/apt/lists/*
# GeoServer
RUN mkdir -p /usr/local/tomcat/conf/Catalina/localhost/ && \
echo "<Context path=\"${GEOSERVER_PATH}\" docBase=\"/usr/local/geoserver\"></Context>" > /usr/local/tomcat/conf/Catalina/localhost/geoserver.xml
RUN mkdir ${GEOSERVER_DATA_DIR} \
&& mkdir ${GEOSERVER_INSTALL_DIR} \
&& cd ${GEOSERVER_INSTALL_DIR} \
&& wget http://sourceforge.net/projects/geoserver/files/GeoServer/${GEOSERVER_VERSION}/geoserver-${GEOSERVER_VERSION}-war.zip \
&& unzip geoserver-${GEOSERVER_VERSION}-war.zip \
&& unzip geoserver.war \
&& mv data/* ${GEOSERVER_DATA_DIR} \
&& rm -rf geoserver-${GEOSERVER_VERSION}-war.zip geoserver.war target *.txt
# Tomcat environment
ENV CATALINA_OPTS "-server -Djava.awt.headless=true \
-Xms128m -Xmx1560m -XX:NewSize=48m \
-DGEOSERVER_DATA_DIR=${GEOSERVER_DATA_DIR}"
# Create tomcat user to avoid root access.
RUN addgroup --gid 1099 tomcat && useradd -m -u 1099 -g tomcat tomcat \
&& chown -R tomcat:tomcat . \
&& chown -R tomcat:tomcat ${GEOSERVER_DATA_DIR} \
&& chown -R tomcat:tomcat ${GEOSERVER_INSTALL_DIR}
# index.html is used for health check; ensure build fails early if not present
RUN cat ${GEOSERVER_INSTALL_DIR}/index.html
ADD start.sh /usr/local/bin/start.sh
ENTRYPOINT [ "/bin/sh", "/usr/local/bin/start.sh"]
VOLUME ["${GEOSERVER_DATA_DIR}", "${GEOSERVER_EXT_DIR}"]
EXPOSE 8080
HEALTHCHECK --start-period=10s --interval=10s --timeout=5s --retries=50 \
CMD curl -f "http://localhost:8080${GEOSERVER_PATH}/index.html" || exit 1