-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile.template
executable file
·98 lines (84 loc) · 3.1 KB
/
Dockerfile.template
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
FROM openjdk:%%OPENJDK_VERSION%%
ENV ROOTDIR /usr/local
ENV LD_LIBRARY_PATH /usr/local/lib
ENV SPARK_VERSION %%SPARK_VERSION%%
ENV GDAL_VERSION %%GDAL_VERSION%%
ENV LIBPROJ_VERSION %%LIBPROJ_VERSION%%
ENV CORES %%CORES%%
WORKDIR $ROOTDIR/
RUN mkdir -p $ROOTDIR/src
RUN wget -qO- https://download.osgeo.org/gdal/${GDAL_VERSION}/gdal-${GDAL_VERSION}.tar.gz | \
tar -xzC $ROOTDIR/src/
RUN wget -qO- https://download.osgeo.org/proj/proj-${LIBPROJ_VERSION}.tar.gz | \
tar -xzC $ROOTDIR/src/
# Install dependencies
RUN set -ex \
&& deps=" \
python-dev \
python3-dev \
python3-numpy \
python3-pip \
python3-venv \
bash-completion \
libspatialite-dev \
libpq-dev \
libcurl4-gnutls-dev \
libxml2-dev \
libgeos-dev \
libnetcdf-dev \
libpoppler-dev \
libhdf4-alt-dev \
libhdf5-serial-dev \
libpoppler-private-dev \
sqlite3 \
libsqlite3-dev \
libtiff-dev \
" \
&& buildDeps=" \
build-essential \
cmake \
swig \
ant \
pkg-config \
"\
&& apt-get update -y && apt-get install -y $buildDeps $deps --no-install-recommends
# Install PROJ
RUN cd src/proj-${LIBPROJ_VERSION} && ./configure && make -j${CORES} && make install \
&& cd $ROOTDIR && rm -Rf src/proj*
# Install GDAL
RUN cd src/gdal-${GDAL_VERSION} \
&& ./configure --with-java=$JAVA_HOME \
&& make -j${CORES} && make -j${CORES} install && ldconfig
# Install Java bindings for GDAL
RUN cd $ROOTDIR/src/gdal-${GDAL_VERSION}/swig/java && make -j${CORES} && make -j${CORES} install
# Copy binaries to the location expected to be by Mosaic
RUN ln -s $ROOTDIR/lib/libgdal.so /usr/lib/libgdal.so
RUN ln -s $ROOTDIR/lib/libgdal.so.30 /usr/lib/libgdal.so.30
RUN ln -s $ROOTDIR/lib/libgdal.so.30.0.3 /usr/lib/libgdal.so.30.0.3
RUN mkdir -p /usr/lib/jni && ln -s $ROOTDIR/lib/libgdalalljni.so /usr/lib/jni/libgdalalljni.so.30
RUN mkdir -p /usr/lib/ogdi && ln -s $ROOTDIR/lib/libgdal.so /usr/lib/ogdi/libgdal.so
# Add Maven
ARG MAVEN_VERSION=3.9.1
ARG USER_HOME_DIR="/root"
ARG BASE_URL=https://dlcdn.apache.org/maven/maven-3/${MAVEN_VERSION}/binaries
ARG SHA=d3be5956712d1c2cf7a6e4c3a2db1841aa971c6097c7a67f59493a5873ccf8c8b889cf988e4e9801390a2b1ae5a0669de07673acb090a083232dbd3faf82f3e3
RUN mkdir -p $ROOTDIR/share/maven $ROOTDIR/share/maven/ref \
&& echo "Downlaoding maven" \
&& curl -fsSL -o /tmp/apache-maven.tar.gz ${BASE_URL}/apache-maven-${MAVEN_VERSION}-bin.tar.gz \
\
&& echo "Checking download hash" \
&& echo "${SHA} /tmp/apache-maven.tar.gz" | sha512sum -c - \
\
&& echo "Unziping maven" \
&& tar -xzf /tmp/apache-maven.tar.gz -C $ROOTDIR/share/maven --strip-components=1 \
\
&& echo "Cleaning and setting links" \
&& rm -f /tmp/apache-maven.tar.gz \
&& ln -s $ROOTDIR/share/maven/bin/mvn $ROOTDIR/bin/mvn
ENV MAVEN_HOME $ROOTDIR/share/maven
ENV MAVEN_CONFIG "$USER_HOME_DIR/.m2"
# Configure Python virtual environment
RUN pip3 install build wheel keplergl ipython pyspark==$SPARK_VERSION
# Clean up
RUN apt-get purge -y --auto-remove $buildDeps \
&& rm -rf /var/lib/apt/lists/*