forked from xdocker/xgeoserver

Shane
2016-03-09 90ebb1ed84cf22b11f30aff2dd81124ced1ae457
Use WAR/Tomcat, support plugins, document setting memory
3 files modified
1 files added
58 ■■■■ changed files
.gitignore 1 ●●●● patch | view | raw | blame | history
Dockerfile 33 ●●●●● patch | view | raw | blame | history
README.md 22 ●●●●● patch | view | raw | blame | history
resources/plugins/README.txt 2 ●●●●● patch | view | raw | blame | history
.gitignore
@@ -1,2 +1,3 @@
resources/geoserver.zip
resources/plugins/*.zip
.idea
Dockerfile
@@ -16,19 +16,32 @@
#-------------Application Specific Stuff ----------------------------------------------------
RUN apt-get -y install unzip openjdk-7-jre-headless openjdk-7-jre
EXPOSE 8080
ENV GS_VERSION 2.6.1
ENV GEOSERVER_DATA_DIR /opt/geoserver/data_dir
ADD resources /tmp/resources
# A little logic that will fetch the geoserver zip file if it
# is not available locally in the resources dir and
# A little logic that will fetch the geoserver war zip file if it
# is not available locally in the resources dir
RUN if [ ! -f /tmp/resources/geoserver.zip ]; then \
    wget -c http://downloads.sourceforge.net/project/geoserver/GeoServer/2.6.1/geoserver-2.6.1-bin.zip -O /tmp/resources/geoserver.zip; \
      wget -c http://downloads.sourceforge.net/project/geoserver/GeoServer/${GS_VERSION}/geoserver-${GS_VERSION}-war.zip \
    -O /tmp/resources/geoserver.zip; \
    fi; \
    unzip /tmp/resources/geoserver.zip -d /opt && mv -v /opt/geoserver* /opt/geoserver
ENV GEOSERVER_HOME /opt/geoserver
ENV JAVA_HOME /usr/
    unzip /tmp/resources/geoserver.zip -d /tmp/geoserver \
    && mv /tmp/geoserver/geoserver.war /usr/local/tomcat/webapps/geoserver.war \
    && unzip /usr/local/tomcat/webapps/geoserver.war -d /usr/local/tomcat/webapps/geoserver \
    && rm -rf /tmp/geoserver
#ENTRYPOINT "/opt/geoserver/bin/startup.sh"
CMD "/opt/geoserver/bin/startup.sh"
EXPOSE 8080
# Install any plugin zip files in resources/plugins
RUN if ls /tmp/resources/plugins/*.zip > /dev/null 2>&1; then \
      for p in /tmp/resources/plugins/*.zip; do \
        unzip $p -d /tmp/gs_plugin \
        && mv /tmp/gs_plugin/*.jar /usr/local/tomcat/webapps/geoserver/WEB-INF/lib/ \
        && rm -rf /tmp/gs_plugin; \
      done; \
    fi
# Delete resources after installation
RUN rm -rf /tmp/resources
README.md
@@ -40,6 +40,13 @@
docker build -t kartoza/postgis .
```
### Building with plugins
To build a GeoServer image with plugins (e.g. SQL Server plugin, Excel output plugin),
download the plugin zip files from the GeoServer download page and put them in
`resources/plugins` before building. You should also download the matching version
GeoServer WAR zip file to `resources/geoserver.zip`.
## Run
You probably want to also have postgis running too. To create a running 
@@ -76,10 +83,23 @@
docker run -d -v $HOME/geoserver_data:/opt/geoserver/data_dir kartoza/geserver
```
You need to ensure the ``geoserver_data`` directory has sufficinet permissions
You need to ensure the ``geoserver_data`` directory has sufficient permissions
for the docker process to read / write it.
## Setting Tomcat properties
To set Tomcat properties such as maximum heap memory size, create a `setenv.sh` file such as:
```shell
JAVA_OPTS="$JAVA_OPTS -Xmx1536M -XX:MaxPermSize=756M"
JAVA_OPTS="$JAVA_OPTS -Djava.awt.headless=true -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled"
```
Then pass the `setenv.sh` file as a volume at `/usr/local/tomcat/bin/setenv.sh` when running:
```shell
docker run -d -v $HOME/setenv.sh:/usr/local/tomcat/bin/setenv.sh kartoza/geserver
```
## Credits
resources/plugins/README.txt
New file
@@ -0,0 +1,2 @@
Download plugin zips and place them here when building to include them in
the container's GeoServer deployment.