Enable use of custom war build

pull/1/head
Nils Bühner 2021-01-29 18:44:11 +01:00
parent 7dbb9d5ae0
commit 82e350ddaa
3 changed files with 13 additions and 10 deletions

View File

@ -1,8 +1,8 @@
FROM tomcat:jdk11-openjdk-slim FROM tomcat:9.0.41-jdk11-openjdk-slim AS base
ARG GEOSERVER_VERSION=2.18.1 ARG GEOSERVER_VERSION=2.18.2
ARG WAR_URL=https://downloads.sourceforge.net/project/geoserver/GeoServer/${GEOSERVER_VERSION}/geoserver-${GEOSERVER_VERSION}-war.zip ARG GEOSERVER_WAR_SRC=https://downloads.sourceforge.net/project/geoserver/GeoServer/${GEOSERVER_VERSION}/geoserver-${GEOSERVER_VERSION}-war.zip
ARG STABLE_PLUGIN_URL=https://sourceforge.net/projects/geoserver/files/GeoServer/${GEOSERVER_VERSION}/extensions ARG STABLE_PLUGIN_URL=https://sourceforge.net/projects/geoserver/files/GeoServer/${GEOSERVER_VERSION}/extensions
ARG CORS_ENABLED=false ARG CORS_ENABLED=false
@ -32,15 +32,15 @@ RUN apt update && \
apt install -y curl wget openssl zip fontconfig libfreetype6 && \ apt install -y curl wget openssl zip fontconfig libfreetype6 && \
rm -rf ${CATALINA_HOME}/webapps/* rm -rf ${CATALINA_HOME}/webapps/*
ADD "${GEOSERVER_WAR_SRC}" "/tmp/"
# install geoserver # install geoserver
RUN wget --progress=bar:force:noscroll -c --no-check-certificate "${WAR_URL}" -O /tmp/geoserver.zip && \ RUN unzip /tmp/geoserver*.zip geoserver.war -d ${CATALINA_HOME}/webapps && \
unzip /tmp/geoserver.zip geoserver.war -d ${CATALINA_HOME}/webapps && \ mkdir -p ${GEOSERVER_DIR} && \unzip -q ${CATALINA_HOME}/webapps/geoserver.war -d ${GEOSERVER_DIR} && \
mkdir -p ${GEOSERVER_DIR} && \
unzip -q ${CATALINA_HOME}/webapps/geoserver.war -d ${GEOSERVER_DIR} && \
rm ${CATALINA_HOME}/webapps/geoserver.war rm ${CATALINA_HOME}/webapps/geoserver.war
# configure CORS (inspired by https://github.com/oscarfonts/docker-geoserver) # configure CORS (inspired by https://github.com/oscarfonts/docker-geoserver)
RUN if [ "$CORS_ENABLED" = "true" ]; then \ RUN if [ "${CORS_ENABLED}" = "true" ]; then \
sed -i "\:</web-app>:i\ \ sed -i "\:</web-app>:i\ \
<filter>\n\ \ <filter>\n\ \
<filter-name>CorsFilter</filter-name>\n\ \ <filter-name>CorsFilter</filter-name>\n\ \

View File

@ -10,7 +10,10 @@ Work is still in progress!
1. The [Dockerfile](Dockerfile) 1. The [Dockerfile](Dockerfile)
1. installs dependencies 1. installs dependencies
1. installs the GeoServer by downloading and extracting the war file 1. installs the GeoServer by adding a ZIP and extracting the WAR from it
1. the expected file name of the war in the zip is `geoserver.war`
1. by default, the GeoServer URL from sourceforge is used, but you could also provide a custom URL with a zip in the `GEOSERVER_WAR_SRC` build argument.
1. you can also use the `GEOSERVER_WAR_SRC` build argument to burn your custom WAR file from your local machine to the docker image, e.g. with something like `docker build -t geoserver:test --build-arg GEOSERVER_WAR_SRC="./resources/geoserver.zip" .`
1. defines defaults for environment variables 1. defines defaults for environment variables
1. The [entrypoint.sh](scripts/entrypoint.sh) startup script (in a running container) 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. executes [install-extensions.sh](scripts/install-extensions.sh) to download and install GeoServer extensions based on the `STABLE_EXTENSIONS` environment variable.

View File

@ -4,7 +4,7 @@ services:
build: build:
context: . context: .
args: args:
- GEOSERVER_VERSION=2.18.1 - GEOSERVER_VERSION=2.18.2
- CORS_ENABLED=true - CORS_ENABLED=true
- CORS_ALLOWED_METHODS=GET,POST,PUT,HEAD,OPTIONS - CORS_ALLOWED_METHODS=GET,POST,PUT,HEAD,OPTIONS
ports: ports: