Skip to content

Instantly share code, notes, and snippets.

@gannebamm
Created September 26, 2019 09:27
Show Gist options
  • Save gannebamm/5ad151dfbac5066bca42f935e1110d7c to your computer and use it in GitHub Desktop.
Save gannebamm/5ad151dfbac5066bca42f935e1110d7c to your computer and use it in GitHub Desktop.
Variant of SPC-Geonode geoserver Dockerfile to enable community plugin installations
FROM openjdk:8-jre-alpine
# since 2.15.x is not stable
# and will cause h2 lockdowns
ARG version=2.14.4
ARG branch=2.14.x
ARG plugins=
ARG commpluginfiles=geoserver-2.14-SNAPSHOT-geopkg-plugin.zip
# Install dependencies
RUN apk add --no-cache ca-certificates openssl curl postgresql-client fontconfig ttf-ubuntu-font-family
RUN update-ca-certificates
WORKDIR /
# Download Geoserver
# we first download vanilla geoserver, as it comes with preset jetty and launch scripts
# then we replace it with the geonode build
# TODO : this is a bit dirty..... can't we stat from vanilla Geoserver ?
# TODO : merge into on step
RUN echo "Download geoserver for geonode" && \
wget https://downloads.sourceforge.net/project/geoserver/GeoServer/$version/geoserver-$version-bin.zip && \
wget https://build.geo-solutions.it/geonode/geoserver/latest/geoserver-$branch.war --no-check-certificate && \
unzip geoserver-$version-bin.zip && \
mv geoserver-$version geoserver && \
rm /geoserver-$version-bin.zip && \
rm /geoserver-$version/webapps/geoserver/* -rf && \
unzip -o geoserver-$branch.war -d /geoserver/webapps/geoserver/ && \
rm /geoserver-$branch.war
# Plugins support
# Example:
# $ docker-compose build --build-arg plugins="csw" geoserver
RUN for plugin in $plugins; do \
wget https://downloads.sourceforge.net/project/geoserver/GeoServer/$version/extensions/geoserver-$version-$plugin-plugin.zip && \
unzip -o geoserver-$version-$plugin-plugin.zip -d /geoserver/webapps/geoserver/WEB-INF/lib && \
rm geoserver-$version-$plugin-plugin.zip; \
done
# for community plugins
# $ docker-compose build --build-arg commpluginfiles="geoserver-2.14-SNAPSHOT-geopkg-plugin.zip" geoserver
RUN for commpluginfile in $commpluginfiles; do \
echo "Download $commpluginfile for GeoServer" && \
echo "at: https://build.geoserver.org/geoserver/$branch/community-latest/$commpluginfile" && \
wget https://build.geoserver.org/geoserver/$branch/community-latest/$commpluginfile && \
unzip -o $commpluginfile -d /geoserver/webapps/geoserver/WEB-INF/lib && \
rm $commpluginfile; \
done
# later get PostgreSQL and PostGIS libs for GeoFence:
# RUN wget https://build.geo-solutions.it/geonode/geoserver/latest/hibernate-spatial-postgis-1.1.3.1/hibernate-spatial-postgis-1.1.3.1.jar
#RUN mv hibernate-spatial-postgis-1.1.3.1.jar /geoserver/webapps/geoserver/WEB-INF/hibernate-spatial-postgis-1.1.3.1.jar
#RUN wget https://build.geo-solutions.it/geonode/geoserver/latest/postgis-jdbc-1.3.3/postgis-jdbc-1.3.3.jar
#RUN mv postgis-jdbc-1.3.3.jar /geoserver/webapps/geoserver/WEB-INF/postgis-jdbc-1.3.3.jar
# Download initial data dir
RUN wget https://build.geo-solutions.it/geonode/geoserver/latest/data-$branch.zip --no-check-certificate
RUN unzip /data-$branch.zip
RUN ls /data
WORKDIR /geoserver/
# Add the entrypoint
ADD docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]
# Export ports
EXPOSE 8080
# Set environnment variables
ENV GEOSERVER_HOME=/geoserver
ENV GEOSERVER_DATA_DIR=/spcgeonode-geodatadir
# Run geoserver
CMD ["bin/startup.sh"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment