From 8383a53de200b231b029daadaf0ca9abe7d2b91d Mon Sep 17 00:00:00 2001
From: Alex Leith <alexgleith@gmail.com>
Date: Mon, 14 Mar 2016 10:38:19 +0800
Subject: [PATCH] Merge remote-tracking branch 'shane-axiom/master'
---
resources/overlays/README.txt | 14 +++++++
Dockerfile | 44 +++++++++++++++++++++-
.gitignore | 9 +++-
README.md | 27 +++++++++++++
4 files changed, 90 insertions(+), 4 deletions(-)
diff --git a/.gitignore b/.gitignore
index f5017bf..245321d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,8 @@
-resources/geoserver.zip
-resources/plugins/*.zip
+resources/*
+!resources/plugins/
+resources/plugins/*
+!resources/plugins/README.txt
+!resources/overlays/
+resources/overlays/*
+!resources/overlays/README.txt
.idea
diff --git a/Dockerfile b/Dockerfile
index 7c16a5f..b076dd2 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -16,12 +16,46 @@
#-------------Application Specific Stuff ----------------------------------------------------
-EXPOSE 8080
-
ENV GS_VERSION 2.6.1
ENV GEOSERVER_DATA_DIR /opt/geoserver/data_dir
+# Unset Java related ENVs since they may change with Oracle JDK
+ENV JAVA_VERSION=
+ENV JAVA_DEBIAN_VERSION=
+
+# Set JAVA_HOME to /usr/lib/jvm/default-java and link it to OpenJDK installation
+RUN ln -s /usr/lib/jvm/java-7-openjdk-amd64 /usr/lib/jvm/default-java
+ENV JAVA_HOME /usr/lib/jvm/default-java
+
ADD resources /tmp/resources
+
+# If a matching Oracle JDK tar.gz exists in /tmp/resources, move it to /var/cache/oracle-jdk7-installer
+# where oracle-java7-installer will detect it
+RUN if ls /tmp/resources/*jdk-*-linux-x64.tar.gz > /dev/null 2>&1; then \
+ mkdir /var/cache/oracle-jdk7-installer && \
+ mv /tmp/resources/*jdk-*-linux-x64.tar.gz /var/cache/oracle-jdk7-installer/; \
+ fi;
+
+# Install Oracle JDK (and uninstall OpenJDK JRE) if the build-arg ORACLE_JDK = true or an Oracle tar.gz
+# was found in /tmp/resources
+ARG ORACLE_JDK=false
+RUN if ls /var/cache/oracle-jdk7-installer/*jdk-*-linux-x64.tar.gz > /dev/null 2>&1 || [ "$ORACLE_JDK" = true ]; then \
+ apt-get autoremove --purge -y openjdk-7-jre-headless && \
+ echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true \
+ | debconf-set-selections && \
+ echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" \
+ > /etc/apt/sources.list.d/webupd8team-java.list && \
+ apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886 && \
+ apt-get update && \
+ apt-get install -y oracle-java7-installer oracle-java7-set-default && \
+ ln -s --force /usr/lib/jvm/java-7-oracle /usr/lib/jvm/default-java && \
+ rm -rf /var/lib/apt/lists/* && \
+ rm -rf /var/cache/oracle-jdk7-installer; \
+ if [ -f /tmp/resources/jce_policy.zip ]; then \
+ unzip -j /tmp/resources/jce_policy.zip -d /tmp/jce_policy && \
+ mv /tmp/jce_policy/*.jar $JAVA_HOME/jre/lib/security/; \
+ fi; \
+ fi;
# A little logic that will fetch the geoserver war zip file if it
# is not available locally in the resources dir
@@ -43,5 +77,11 @@
done; \
fi
+# Overlay files and directories in resources/overlays if they exist
+RUN rm /tmp/resources/overlays/README.txt && \
+ if ls /tmp/resources/overlays/* > /dev/null 2>&1; then \
+ cp -rf /tmp/resources/overlays/* /; \
+ fi;
+
# Delete resources after installation
RUN rm -rf /tmp/resources
diff --git a/README.md b/README.md
index 102d19a..d2be021 100644
--- a/README.md
+++ b/README.md
@@ -40,6 +40,22 @@
docker build -t kartoza/postgis .
```
+### Building with Oracle JDK
+
+To replace OpenJDK Java with the Oracle JDK, set build-arg `OPEN_JDK=true`:
+
+```shell
+docker build --build-arg OPEN_JDK=true -t kartoza/postgis .
+```
+
+Alternatively, you can download the Oracle JDK 7 Linux x64 tar.gz currently in use by
+[webupd8team's Oracle JDK installer](https://launchpad.net/~webupd8team/+archive/ubuntu/java/+packages)
+(usually the latest version available from Oracle) and place it in `resources` before building.
+
+To enable strong cryptography when using the Oracle JDK (recommended), download the
+[Oracle Java policy jar zip](http://docs.geoserver.org/latest/en/user/production/java.html#oracle-java)
+for the correct JDK version and place it at `resources/jce_policy.zip` before building.
+
### Building with plugins
To build a GeoServer image with plugins (e.g. SQL Server plugin, Excel output plugin),
@@ -47,6 +63,17 @@
`resources/plugins` before building. You should also download the matching version
GeoServer WAR zip file to `resources/geoserver.zip`.
+### Building with file system overlays (advanced)
+
+The contents of `resources/overlays` will be copied to the image file system
+during the build. For example, to include a static Tomcat `setenv.sh`,
+create the file at `resources/overlays/usr/local/tomcat/bin/setenv.sh`.
+
+You can use this functionality to write a static GeoServer directory to
+`/opt/geoserver/data_dir`, include additional jar files, and more.
+
+Overlay files will overwrite existing destination files, so be careful!
+
## Run
You probably want to also have postgis running too. To create a running
diff --git a/resources/overlays/README.txt b/resources/overlays/README.txt
new file mode 100644
index 0000000..4699e93
--- /dev/null
+++ b/resources/overlays/README.txt
@@ -0,0 +1,14 @@
+To include files in the container file system at arbitrary locations, build
+a directory structure from / here and include the files at the desired location.
+
+For example, to include a static Tomcat setenv.sh in the build, place it at:
+
+resources/overlays/usr/local/tomcat/bin/setenv.sh
+
+Other overlay examples include static GeoServer data directories, the Marlin renderer, etc.
+
+Note that overlay files will overwrite existing destination files, and that
+files in the overlay root will be copied to the container root
+(e.g. resources/overlay/somefile.txt will be copied to /somefile.txt).
+
+Be careful!
--
Gitblit v0.0.0-SNAPSHOT