This repository has been archived by the owner on Mar 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
189 lines (168 loc) · 5.2 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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# Geospatial Swiss Army Knife image
FROM openjdk:13-jdk-slim
# UTF-8 all the things
RUN \
apt-get clean -y && apt-get update && \
apt-get install -y apt-utils locales && \
echo "LC_ALL=en_US.UTF-8" >> /etc/environment && \
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen && \
echo "LANG=en_US.UTF-8" > /etc/locale.conf && \
locale-gen en_US.UTF-8 && \
apt-get clean all
# ENVs
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
ENV ROOTDIR /usr/local/
#ENV LD_LIBRARY_PATH /usr/local/lib
#ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig
# Load assets
WORKDIR $ROOTDIR/
# pkg-config needed by gdal to find openjpeg
# gdal uses curl, libcurl4
# gdal build uses cmake
RUN \
apt-get update && \
apt-get install -y \
pkg-config \
software-properties-common \
python-pip \
python2.7 \
python-numpy \
python3-software-properties \
python3-pip \
gcc \
g++ \
curl \
build-essential \
libcurl4-gnutls-dev \
file \
sqlite3 \
libsqlite3-dev \
bash-completion \
cmake \
wget \
imagemagick \
&& apt-get clean all
# Install Pip and AWS CLI
RUN pip3 install --upgrade pip awscli
# OPENJPEG versions prior to 2.3.0 have problems processing large jp2 files
# https://lists.osgeo.org/pipermail/gdal-dev/2017-October/047397.html
ENV OPENJPEG_VERSION 2.3.1
# Compile and install OpenJPEG for GDAL
RUN \
cd $ROOTDIR/src && \
wget -q https://github.com/uclouvain/openjpeg/archive/v${OPENJPEG_VERSION}.tar.gz && \
tar -xvf v${OPENJPEG_VERSION}.tar.gz && \
cd openjpeg-${OPENJPEG_VERSION}/ && \
mkdir build && \
cd build && \
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$ROOTDIR && \
make -j4 && \
make install && \
rm -Rf $ROOTDIR/src/openjpeg* $ROOTDIR/src/v${OPENJPEG_VERSION}.tar.gz
ENV PROJ_VERSION 6.3.2
# Compile and install PROJ 6
RUN \
cd $ROOTDIR/src && \
wget -q https://download.osgeo.org/proj/proj-${PROJ_VERSION}.tar.gz && \
tar -xvf proj-${PROJ_VERSION}.tar.gz && \
cd proj-${PROJ_VERSION}/ && \
./configure && \
make -j4 && \
make install && \
rm -Rf $ROOTDIR/src/proj-*
ENV GDAL_VERSION 3.1.2
# Compile and install GDAL
# JPEG2000 - used by Sentinel-2, use openjpeg and none of the others
# GeoTIFF - included, use internal version
RUN \
cd $ROOTDIR/src && \
wget http://download.osgeo.org/gdal/${GDAL_VERSION}/gdal-${GDAL_VERSION}.tar.gz && \
tar -xvf gdal-${GDAL_VERSION}.tar.gz && \
cd gdal-${GDAL_VERSION} && \
./configure \
--with-curl \
--with-geos \
--with-geotiff=internal \
--with-hide-internal-symbols \
--with-jpeg \
--with-libtiff=internal \
--with-libz=internal \
--with-openjpeg \
--with-png \
--with-python \
--with-threads \
--without-cfitsio \
--without-cryptopp \
--without-ecw \
--without-expat \
--without-fme \
--without-freexl \
--without-gif \
--without-gif \
--without-gnm \
--without-grass \
--without-hdf4 \
--without-hdf5 \
--without-idb \
--without-ingres \
--without-jasper \
--without-jp2mrsid \
--without-kakadu \
--without-libgrass \
--without-libkml \
--without-libtool \
--without-mrsid \
--without-mysql \
--without-netcdf \
--without-odbc \
--without-ogdi \
--without-pcidsk \
--without-pcraster \
--without-pcre \
--without-perl \
--without-pg \
--without-qhull \
--without-sde \
--without-sqlite3 \
--without-webp \
--without-xerces \
--without-xml2 | tee /dev/stderr | grep "OpenJPEG support:\s\+yes" \
&& \
make -j4 && \
make install && \
ldconfig && \
apt-get remove -y --purge build-essential && \
apt-get autoremove -y && apt-get clean all && \
rm -Rf $ROOTDIR/src/gdal*
# Final apt-get cleanup
RUN rm -rf /var/lib/apt/lists/* && apt-get autoremove -y && apt-get clean all
# install these for gdal_calc.py
RUN pip3 install --upgrade numpy
RUN pip3 install --upgrade GDAL
# Load assets
WORKDIR $ROOTDIR/
ENV SCALA_VERSION 2.13.3
ENV SBT_VERSION 1.3.13
# Install Scala
RUN \
curl -fsL https://downloads.typesafe.com/scala/$SCALA_VERSION/scala-$SCALA_VERSION.tgz | tar xfz - -C /root/ && \
echo >> /root/.bashrc && \
echo "export PATH=~/scala-$SCALA_VERSION/bin:$PATH" >> /root/.bashrc
# Install SBT
RUN \
curl -L -o sbt-$SBT_VERSION.deb https://dl.bintray.com/sbt/debian/sbt-$SBT_VERSION.deb && \
dpkg -i sbt-$SBT_VERSION.deb && \
rm sbt-$SBT_VERSION.deb && \
apt-get install sbt && \
apt-get clean all && \
sbt sbtVersion
# Final apt-get cleanup
RUN rm -rf /var/lib/apt/lists/* && apt-get autoremove -y && apt-get clean all
COPY vcog.py /usr/local/bin
RUN chmod u+x /usr/local/bin/vcog.py
# Externally accessible data is by default put in /data
WORKDIR /data
VOLUME ["/data"]
# Output version and capabilities by default.
CMD gdalinfo --version && gdalinfo --formats && java -version && javac -version && echo sbt sbtVersion: `sbt sbtVersion` && aws --version