Add first Dockerfile implementation
parent
b70d564d5a
commit
eee16c94e4
|
|
@ -0,0 +1 @@
|
||||||
|
*.iml
|
||||||
|
|
@ -0,0 +1,57 @@
|
||||||
|
ARG TOMCAT_VERSION=9.0.38
|
||||||
|
ARG JAVA_VERSION=8
|
||||||
|
ARG IMAGE_VERSION=${TOMCAT_VERSION}-jdk${JAVA_VERSION}-openjdk-slim
|
||||||
|
|
||||||
|
FROM tomcat:$IMAGE_VERSION
|
||||||
|
|
||||||
|
ARG GS_VERSION=2.18.0
|
||||||
|
ARG MARLIN_TAG=0_9_4_3
|
||||||
|
ARG MARLIN_VERSION=0.9.4.3
|
||||||
|
|
||||||
|
ARG WAR_URL=https://downloads.sourceforge.net/project/geoserver/GeoServer/${GS_VERSION}/geoserver-${GS_VERSION}-war.zip
|
||||||
|
ARG STABLE_PLUGIN_URL=https://sourceforge.net/projects/geoserver/files/GeoServer/${GS_VERSION}/extensions
|
||||||
|
|
||||||
|
# environment variables
|
||||||
|
ENV GS_VERSION=${GS_VERSION} \
|
||||||
|
MARLIN_TAG=${MARLIN_TAG} \
|
||||||
|
MARLIN_VERSION=${MARLIN_VERSION} \
|
||||||
|
WAR_URL=${WAR_URL} \
|
||||||
|
STABLE_PLUGIN_URL=${STABLE_PLUGIN_URL} \
|
||||||
|
INITIAL_MEMORY="2G" \
|
||||||
|
MAXIMUM_MEMORY="4G" \
|
||||||
|
JAIEXT_ENABLED=true \
|
||||||
|
STABLE_EXTENSIONS='' \
|
||||||
|
# COMMUNITY_EXTENSIONS='' \
|
||||||
|
DEBIAN_FRONTEND=noninteractive \
|
||||||
|
EXTENSION_DOWNLOAD_DIR=/opt/geoserver_extension_downloads \
|
||||||
|
GEOSERVER_DATA_DIR=/opt/geoserver_data \
|
||||||
|
GEOWEBCACHE_CACHE_DIR=/opt/geowebcache_data
|
||||||
|
|
||||||
|
RUN mkdir ${EXTENSION_DOWNLOAD_DIR} ${GEOSERVER_DATA_DIR} ${GEOWEBCACHE_CACHE_DIR}
|
||||||
|
|
||||||
|
# install required dependencies
|
||||||
|
# also clear the initial webapps
|
||||||
|
RUN apt update && \
|
||||||
|
apt install -y curl wget openssl zip fontconfig libfreetype6 && \
|
||||||
|
rm -rf ${CATALINA_HOME}/webapps/*
|
||||||
|
|
||||||
|
# install geoserver
|
||||||
|
RUN wget --progress=bar:force:noscroll -c --no-check-certificate "${WAR_URL}" -O /tmp/geoserver.zip && \
|
||||||
|
unzip /tmp/geoserver.zip geoserver.war -d ${CATALINA_HOME}/webapps && \
|
||||||
|
mkdir -p ${CATALINA_HOME}/webapps/geoserver && \
|
||||||
|
unzip -q ${CATALINA_HOME}/webapps/geoserver.war -d ${CATALINA_HOME}/webapps/geoserver && \
|
||||||
|
rm ${CATALINA_HOME}/webapps/geoserver.war
|
||||||
|
|
||||||
|
# install marlin renderer
|
||||||
|
RUN wget --progress=bar:force:noscroll -c --no-check-certificate https://github.com/bourgesl/marlin-renderer/releases/download/v${MARLIN_TAG}/marlin-${MARLIN_VERSION}-Unsafe.jar -O ${CATALINA_HOME}/lib/marlin-${MARLIN_VERSION}-Unsafe.jar
|
||||||
|
|
||||||
|
# copy scripts
|
||||||
|
COPY scripts /scripts
|
||||||
|
RUN chmod +x /scripts/*.sh
|
||||||
|
|
||||||
|
# cleanup
|
||||||
|
RUN apt clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||||
|
|
||||||
|
WORKDIR ${CATALINA_HOME}
|
||||||
|
|
||||||
|
CMD ["/bin/sh", "/scripts/entrypoint.sh"]
|
||||||
53
README.md
53
README.md
|
|
@ -1,2 +1,51 @@
|
||||||
# docker
|
# Docker GeoServer image
|
||||||
GeoServer docker image
|
|
||||||
|
This docker GeoServer image is based on the following proposal:
|
||||||
|
|
||||||
|
https://github.com/geoserver/geoserver/wiki/GSIP-192
|
||||||
|
|
||||||
|
Work is still in progress!
|
||||||
|
|
||||||
|
## How it works
|
||||||
|
|
||||||
|
1. The [Dockerfile](Dockerfile)
|
||||||
|
1. installs dependencies
|
||||||
|
1. installs the GeoServer by downloading and extracting the war file
|
||||||
|
1. installs the marlin renderer
|
||||||
|
1. defines defaults for environment variables
|
||||||
|
1. The [entrypoint.sh](scripts/entrypoint.sh) startup script (in a running container)
|
||||||
|
1. executes [install-extensions.sh](scripts/install-extensions.sh) to download and install GeoServer extensions based on the `STABLE_EXTENSIONS` environment variable.
|
||||||
|
1. handles the `GEOSERVER_OPTS`
|
||||||
|
1. starts the tomcat
|
||||||
|
|
||||||
|
## Building
|
||||||
|
|
||||||
|
`docker build -t geoserver:test .`
|
||||||
|
|
||||||
|
## Running
|
||||||
|
|
||||||
|
`docker run -it -e STABLE_EXTENSIONS='wps,csw' -p 8080:8080 geoserver:test`
|
||||||
|
|
||||||
|
The extensions will be downloaded on startup of the image (before starting the tomcat).
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
Pass as environment variables. If not passed, the default values will be used.
|
||||||
|
|
||||||
|
* `GEOSERVER_DATA_DIR` (default: /opt/geoserver_data)
|
||||||
|
* `INITIAL_MEMORY` (default: 2G)
|
||||||
|
* `MAXIMUM_MEMORY` (default: 4G)
|
||||||
|
* `JAIEXT_ENABLED` (default: true)
|
||||||
|
* `STABLE_EXTENSIONS` as comma separated list, will be downloaded and installed on startup (default: "")
|
||||||
|
|
||||||
|
## TODOs
|
||||||
|
|
||||||
|
* CORS
|
||||||
|
* configuration of JNDI connections in the tomcat/custom tomcat configuration in general
|
||||||
|
* default data for gs datadir?
|
||||||
|
* possibility to add custom java dependencies (for example the oracle jdbc driver)
|
||||||
|
* in this context: mount `EXTENSION_DOWNLOAD_DIR` and implement checks to cache extensions that have already been downloaded before?
|
||||||
|
* log4j properties
|
||||||
|
* add possibility to add custom fonts
|
||||||
|
* starting from which version we want to provide geoserver images (maybe 2.15.x?)/backwards compatability
|
||||||
|
* add a docker-compose demo environment?
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
#!/bin/bash
|
||||||
|
## Inspired by https://github.com/kartoza/docker-geoserver
|
||||||
|
set -e
|
||||||
|
|
||||||
|
## install GeoServer extensions before starting the tomcat
|
||||||
|
echo "Starting installation of extensions"
|
||||||
|
/scripts/install-extensions.sh
|
||||||
|
echo "\nFinished installation of extensions"
|
||||||
|
|
||||||
|
export GEOSERVER_OPTS="-Djava.awt.headless=true -server \
|
||||||
|
-Dfile.encoding=UTF8 \
|
||||||
|
-Djavax.servlet.request.encoding=UTF-8 \
|
||||||
|
-Djavax.servlet.response.encoding=UTF-8 \
|
||||||
|
-Xms${INITIAL_MEMORY} -Xmx${MAXIMUM_MEMORY} \
|
||||||
|
-XX:SoftRefLRUPolicyMSPerMB=36000 -XX:+UseG1GC \
|
||||||
|
-XX:MaxGCPauseMillis=200 -XX:ParallelGCThreads=20 -XX:ConcGCThreads=5 \
|
||||||
|
-Xbootclasspath/a:${CATALINA_HOME}/lib/marlin-${MARLIN_VERSION}-Unsafe.jar \
|
||||||
|
-Dsun.java2d.renderer=org.marlin.pisces.MarlinRenderingEngine \
|
||||||
|
-Dorg.geotools.coverage.jaiext.enabled=${JAIEXT_ENABLED}"
|
||||||
|
|
||||||
|
## JVM command line arguments
|
||||||
|
export JAVA_OPTS="${JAVA_OPTS} ${GEOSERVER_OPTS}"
|
||||||
|
|
||||||
|
## Start the tomcat
|
||||||
|
exec /usr/local/tomcat/bin/catalina.sh run
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Inspired by https://github.com/kartoza/docker-geoserver
|
||||||
|
|
||||||
|
function download_extension() {
|
||||||
|
URL=$1
|
||||||
|
EXTENSION=$2
|
||||||
|
if curl --output /dev/null --silent --head --fail "${URL}"; then
|
||||||
|
DOWNLOAD_FILE="${EXTENSION_DOWNLOAD_DIR}/geoserver-${GS_VERSION}-${EXTENSION}-plugin.zip"
|
||||||
|
echo -e "\nDownloading ${EXTENSION}-extension from ${URL}"
|
||||||
|
wget --progress=bar:force:noscroll -c --no-chec k-certificate "${URL}" -O ${DOWNLOAD_FILE}
|
||||||
|
unzip -q -o ${DOWNLOAD_FILE} -d ${CATALINA_HOME}/webapps/geoserver/WEB-INF/lib
|
||||||
|
else
|
||||||
|
echo "URL does not exist: ${URL}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Install stable plugins
|
||||||
|
for EXTENSION in $(echo "${STABLE_EXTENSIONS}" | tr ',' ' '); do
|
||||||
|
URL="${STABLE_PLUGIN_URL}/geoserver-${GS_VERSION}-${EXTENSION}-plugin.zip"
|
||||||
|
download_extension ${URL} ${EXTENSION}
|
||||||
|
done
|
||||||
Loading…
Reference in New Issue