forked from xdocker/xgeoserver

Shane
2016-03-10 b6c0bf488b0505ec5549b6c81724925b278ed931
Allow option to install Oracle JDK via download or resources tarball
3 files modified
47 ■■■■■ changed files
.gitignore 1 ●●●● patch | view | raw | blame | history
Dockerfile 34 ●●●●● patch | view | raw | blame | history
README.md 12 ●●●●● patch | view | raw | blame | history
.gitignore
@@ -1,3 +1,4 @@
resources/geoserver.zip
resources/plugins/*.zip
resources/*jdk-*-linux-x64.tar.gz
.idea
Dockerfile
@@ -16,13 +16,43 @@
#-------------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; \
    fi;
# 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 \
README.md
@@ -40,6 +40,18 @@
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.
### Building with plugins
To build a GeoServer image with plugins (e.g. SQL Server plugin, Excel output plugin),