forked from Unidata/thredds-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
146 lines (97 loc) · 3.08 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
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
136
137
138
139
140
141
142
143
144
145
146
###
# Dockerfile for TDS
###
FROM unidata/tomcat-docker:8.5
MAINTAINER Unidata
###
# Usual maintenance
###
USER root
RUN \
apt-get update && \
apt-get install -y unzip vim build-essential m4 libpthread-stubs0-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN mkdir /downloads
WORKDIR /downloads
###
# Installing netcdf-c library according to:
# http://www.unidata.ucar.edu/software/thredds/current/netcdf-java/reference/netcdf4Clibrary.html
###
ENV LD_LIBRARY_PATH /usr/local/lib:${LD_LIBRARY_PATH}
ENV HDF5_VERSION 1.8.17
ENV ZLIB_VERSION 1.2.8
ENV NETCDF_VERSION 4.4.1
ENV ZDIR /usr/local
ENV H5DIR /usr/local
ENV PDIR /usr
#zlib dependency
RUN curl ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4/zlib-${ZLIB_VERSION}.tar.gz | tar xz && \
cd zlib-${ZLIB_VERSION} && \
./configure --prefix=/usr/local && \
make && make install
ENV HDF5_VER hdf5-${HDF5_VERSION}
ENV HDF5_FILE ${HDF5_VER}.tar.gz
#hdf5 dependency
RUN curl https://support.hdfgroup.org/ftp/HDF5/releases/${HDF5_VER%.*}/${HDF5_VER}/src/${HDF5_FILE} | tar xz && \
cd hdf5-${HDF5_VERSION} && \
./configure --with-zlib=${ZDIR} --prefix=${H5DIR} --enable-threadsafe --with-pthread=${PDIR} --enable-unsupported --prefix=/usr/local && \
make && make check && make install && make check-install && ldconfig
#netCDF4-c
RUN export CPPFLAGS=-I/usr/local/include \
LDFLAGS=-L/usr/local/lib && \
curl ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-${NETCDF_VERSION}.tar.gz | tar xz && \
cd netcdf-${NETCDF_VERSION} && \
./configure --prefix=/usr/local && \
make check && make install && ldconfig
###
# Grab and unzip the TDS
###
ENV TDS_VERSION 4.6.11
ENV TDS_CONTENT_ROOT_PATH /usr/local/tomcat/content
# The amount of Xmx and Xms memory Java args to allocate to THREDDS
ENV THREDDS_XMX_SIZE 4G
ENV THREDDS_XMS_SIZE 4G
ENV THREDDS_WAR_URL https://artifacts.unidata.ucar.edu/repository/unidata-releases/edu/ucar/tds/${TDS_VERSION}/tds-${TDS_VERSION}.war
RUN curl -fSL "${THREDDS_WAR_URL}" -o thredds.war
RUN unzip thredds.war -d ${CATALINA_HOME}/webapps/thredds/
###
# Default thredds config
###
RUN mkdir -p ${CATALINA_HOME}/content/thredds
COPY files/threddsConfig.xml ${CATALINA_HOME}/content/thredds/threddsConfig.xml
###
# Tomcat users
###
COPY files/tomcat-users.xml ${CATALINA_HOME}/conf/tomcat-users.xml
###
# Tomcat Java Options
###
COPY files/setenv.sh $CATALINA_HOME/bin/setenv.sh
COPY files/javaopts.sh $CATALINA_HOME/bin/javaopts.sh
RUN chmod 755 $CATALINA_HOME/bin/*.sh
###
# Creating .systemPrefs directory according to
# http://www.unidata.ucar.edu/software/thredds/current/tds/faq.html#javaUtilPrefs
# and as defined in the files/javaopts.sh file
###
RUN mkdir -p ${CATALINA_HOME}/javaUtilPrefs/.systemPrefs
###
# Expose ports
###
EXPOSE 8080 8443
###
# Cleanup
###
WORKDIR ${CATALINA_HOME}
RUN rm -rf /downloads
###
# Inherited from parent container
###
ENTRYPOINT ["/entrypoint.sh"]
###
# Start container
###
CMD ["catalina.sh", "run"]
HEALTHCHECK --interval=60s --timeout=3s \
CMD curl --fail 'http://localhost:8080/thredds/catalog.html' || exit 1