This repository was archived by the owner on Aug 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
135 lines (118 loc) · 5.65 KB
/
Dockerfile
File metadata and controls
135 lines (118 loc) · 5.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#
# "Borrowed" from:
# https://hub.docker.com/r/kartoza/geoserver/
#
#--------- Generic stuff all our Dockerfiles should start with so we get caching ------------
FROM tomcat:9.0
MAINTAINER Berend Weel <[email protected]>
RUN export DEBIAN_FRONTEND=noninteractive
ENV DEBIAN_FRONTEND noninteractive
RUN dpkg-divert --local --rename --add /sbin/initctl
#RUN ln -s /bin/true /sbin/initctl
RUN apt-get -y update && apt-get install -y build-essential libgdal-java gdal-bin
#-------------Application Specific Stuff ----------------------------------------------------
ENV GS_VERSION 2.11.2
ENV GEOSERVER_DATA_DIR /opt/geoserver/data_dir
ENV GDAL_DATA /opt/gdal_data
ENV GDAL_NATIVE /opt/gdal_native
ENV LD_LIBRARY_PATH $LD_LIBRARY_PATH:$GDAL_NATIVE
# 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-8-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-jdk8-installer && \
mv /tmp/resources/*jdk-*-linux-x64.tar.gz /var/cache/oracle-jdk8-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-jdk8-installer/*jdk-*-linux-x64.tar.gz > /dev/null 2>&1 || [ "$ORACLE_JDK" = true ]; then \
apt-get autoremove --purge -y openjdk-8-jre-headless && \
echo oracle-java8-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-java8-installer oracle-java8-set-default && \
ln -s --force /usr/lib/jvm/java-8-oracle /usr/lib/jvm/default-java && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /var/cache/oracle-jdk8-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;
#Add JAI and ImageIO for great speedy speed.
WORKDIR /tmp
RUN wget http://download.java.net/media/jai/builds/release/1_1_3/jai-1_1_3-lib-linux-amd64.tar.gz && \
wget http://download.java.net/media/jai-imageio/builds/release/1.1/jai_imageio-1_1-lib-linux-amd64.tar.gz && \
gunzip -c jai-1_1_3-lib-linux-amd64.tar.gz | tar xf - && \
gunzip -c jai_imageio-1_1-lib-linux-amd64.tar.gz | tar xf - && \
mv /tmp/jai-1_1_3/lib/*.jar $JAVA_HOME/jre/lib/ext/ && \
mv /tmp/jai-1_1_3/lib/*.so $JAVA_HOME/jre/lib/amd64/ && \
mv /tmp/jai_imageio-1_1/lib/*.jar $JAVA_HOME/jre/lib/ext/ && \
mv /tmp/jai_imageio-1_1/lib/*.so $JAVA_HOME/jre/lib/amd64/ && \
rm /tmp/jai-1_1_3-lib-linux-amd64.tar.gz && \
rm -r /tmp/jai-1_1_3 && \
rm /tmp/jai_imageio-1_1-lib-linux-amd64.tar.gz && \
rm -r /tmp/jai_imageio-1_1
WORKDIR $CATALINA_HOME
# 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/${GS_VERSION}/geoserver-${GS_VERSION}-war.zip \
-O /tmp/resources/geoserver.zip; \
fi; \
unzip /tmp/resources/geoserver.zip -d /tmp/geoserver \
&& unzip /tmp/geoserver/geoserver.war -d $CATALINA_HOME/webapps/geoserver \
&& rm -rf $CATALINA_HOME/webapps/geoserver/data \
&& rm -rf /tmp/geoserver
# 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 $CATALINA_HOME/webapps/geoserver/WEB-INF/lib/ \
&& rm -rf /tmp/gs_plugin; \
done; \
fi
# Install any gdal-data zip files in resources/gdal-data
RUN if ls /tmp/resources/gdal-data/*.zip > /dev/null 2>&1; then \
for p in /tmp/resources/gdal-data/*.zip; do \
unzip $p -d /tmp/gdal-data \
&& mv /tmp/gdal-data/* $GDAL_DATA \
&& rm -rf /tmp/gdal-data; \
done; \
fi
# Install gdal-native zip files in resources/gdal-data
RUN if ls /tmp/resources/gdal-native/*.zip > /dev/null 2>&1; then \
mkdir -p $GDAL_NATIVE; \
for p in /tmp/resources/gdal-native/*.zip; do \
unzip $p -d /tmp/gdal-native \
&& mv /tmp/gdal-native/* $GDAL_NATIVE \
&& rm -rf /tmp/gdal-native; \
done; \
fi
# Overlay files and directories in resources/overlays if they exist
RUN if ls /tmp/resources/overlays/* > /dev/null 2>&1; then \
cp -rf /tmp/resources/overlays/* /; \
fi;
COPY tomcat-users.xml $CATALINA_HOME/conf/
COPY manager.xml $CATALINA_HOME/conf/Catalina/localhost/
# Optionally remove Tomcat manager, docs, and examples
ARG TOMCAT_EXTRAS=true
RUN if [ "$TOMCAT_EXTRAS" = false ]; then \
rm -rf $CATALINA_HOME/webapps/ROOT && \
rm -rf $CATALINA_HOME/webapps/docs && \
rm -rf $CATALINA_HOME/webapps/examples && \
rm -rf $CATALINA_HOME/webapps/host-manager && \
rm -rf $CATALINA_HOME/webapps/manager; \
fi;
# Delete resources after installation
RUN rm -rf /tmp/resources