This repository has been archived by the owner on Oct 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 83
/
Dockerfile
89 lines (78 loc) · 3.22 KB
/
Dockerfile
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
FROM tomcat:9-jre8
MAINTAINER GeoNode Development Team
#
# Set GeoServer version and data directory
#
ENV GEOSERVER_VERSION=2.15.x
ENV GEOSERVER_DATA_DIR="/geoserver_data/data"
#
# Download and install GeoServer
#
RUN cd /usr/local/tomcat/webapps \
&& wget --no-check-certificate --progress=bar:force:noscroll \
https://build.geo-solutions.it/geonode/geoserver/latest/geoserver-${GEOSERVER_VERSION}.war \
&& unzip -q geoserver-${GEOSERVER_VERSION}.war -d geoserver \
&& rm geoserver-${GEOSERVER_VERSION}.war \
&& mkdir -p $GEOSERVER_DATA_DIR
VOLUME $GEOSERVER_DATA_DIR
###########docker host###############
# Set DOCKERHOST variable if DOCKER_HOST exists
ARG DOCKERHOST=${DOCKERHOST}
# for debugging
RUN echo -n #1===>DOCKERHOST=${DOCKERHOST}
#
ENV DOCKERHOST ${DOCKERHOST}
# for debugging
RUN echo -n #2===>DOCKERHOST=${DOCKERHOST}
###########docker host ip#############
# Set GEONODE_HOST_IP address if it exists
ARG GEONODE_HOST_IP=${GEONODE_HOST_IP}
# for debugging
RUN echo -n #1===>GEONODE_HOST_IP=${GEONODE_HOST_IP}
#
ENV GEONODE_HOST_IP ${GEONODE_HOST_IP}
# for debugging
RUN echo -n #2===>GEONODE_HOST_IP=${GEONODE_HOST_IP}
# If empty set DOCKER_HOST_IP to GEONODE_HOST_IP
ENV DOCKER_HOST_IP=${DOCKER_HOST_IP:-${GEONODE_HOST_IP}}
# for debugging
RUN echo -n #1===>DOCKER_HOST_IP=${DOCKER_HOST_IP}
# Trying to set the value of DOCKER_HOST_IP from DOCKER_HOST
RUN if ! [ -z ${DOCKER_HOST_IP} ]; \
then echo export DOCKER_HOST_IP=${DOCKERHOST} | \
sed 's/tcp:\/\/\([^:]*\).*/\1/' >> /root/.bashrc; \
else echo "DOCKER_HOST_IP is already set!"; fi
# for debugging
RUN echo -n #2===>DOCKER_HOST_IP=${DOCKER_HOST_IP}
# Set WEBSERVER public port
ARG PUBLIC_PORT=${PUBLIC_PORT}
# for debugging
RUN echo -n #1===>PUBLIC_PORT=${PUBLIC_PORT}
#
ENV PUBLIC_PORT=${PUBLIC_PORT}
# for debugging
RUN echo -n #2===>PUBLIC_PORT=${PUBLIC_PORT}
# set nginx base url for geoserver
RUN echo export NGINX_BASE_URL=http://${NGINX_HOST}:${NGINX_PORT}/ | \
sed 's/tcp:\/\/\([^:]*\).*/\1/' >> /root/.bashrc
# copy the script and perform the run of scripts from entrypoint.sh
RUN mkdir -p /usr/local/tomcat/tmp
WORKDIR /usr/local/tomcat/tmp
COPY set_geoserver_auth.sh /usr/local/tomcat/tmp
COPY setup_auth.sh /usr/local/tomcat/tmp
COPY requirements.txt /usr/local/tomcat/tmp
COPY get_dockerhost_ip.py /usr/local/tomcat/tmp
COPY get_nginxhost_ip.py /usr/local/tomcat/tmp
COPY entrypoint.sh /usr/local/tomcat/tmp
RUN apt-get update \
&& apt-get -y upgrade \
&& apt-get install -y python python-pip python-dev \
&& chmod +x /usr/local/tomcat/tmp/set_geoserver_auth.sh \
&& chmod +x /usr/local/tomcat/tmp/setup_auth.sh \
&& chmod +x /usr/local/tomcat/tmp/entrypoint.sh \
&& pip install pip==9.0.3 \
&& pip install -r requirements.txt \
&& chmod +x /usr/local/tomcat/tmp/get_dockerhost_ip.py \
&& chmod +x /usr/local/tomcat/tmp/get_nginxhost_ip.py
ENV JAVA_OPTS="-Djava.awt.headless=true -XX:MaxPermSize=512m -XX:PermSize=256m -Xms512m -Xmx2048m -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:ParallelGCThreads=4 -Dfile.encoding=UTF8 -Duser.timezone=GMT -Djavax.servlet.request.encoding=UTF-8 -Djavax.servlet.response.encoding=UTF-8 -Duser.timezone=GMT -Dorg.geotools.shapefile.datetime=true"
CMD ["/usr/local/tomcat/tmp/entrypoint.sh"]