Newer
Older
FROM ubuntu:20.04
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=GMT
ENV LD_LIBRARY_PATH=/usr/local/lib:${LD_LIBRARY_PATH}
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-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
RUN apt-get update && apt-get install -y \
gosu \
pwgen \
tzdata \
gcc \
g++ \
automake \
build-essential \
cmake \
sqlite \
libsqlite3-dev \
libxml2-dev \
libjpeg-dev \
libjpeg-turbo8 \
libjpeg-turbo8-dev \
libpng-dev \
libfreetype6 \
libfreetype6-dev \
libzstd-dev \
libnetcdf-dev \
python3-pip \
pkg-config \
git \
wget \
curl \
unzip \
libcurl4 \
libcurl4-openssl-dev \
zlib1g-dev \
libfribidi-dev \
libharfbuzz-dev \
libcairo2-dev \
libfcgi-dev \
libgeos++-dev \
libpq-dev \
postgresql-server-dev-all \
libxml2-dev \
libgif-dev \
libprotobuf-dev \
protobuf-compiler \
libprotobuf-c-dev \
libprotobuf-c1 \
libprotobuf-dev \
protobuf-c-compiler \
&& rm -rf /var/lib/apt/lists/*
# Install libtiff
RUN mkdir -p /build_deps && cd /build_deps \
&& wget --no-check-certificate https://download.osgeo.org/libtiff/tiff-4.3.0.tar.gz \
&& tar -zxf tiff-4.3.0.tar.gz \
&& cd tiff-4.3.0 \
&& ./configure \
&& make \
&& make install
# Install Proj
RUN cd /build_deps \
&& git clone https://github.com/OSGeo/PROJ.git -b 8.2.1 && cd PROJ \
&& mkdir -p build && cd build \
&& cmake .. \
&& make -j$(nproc) \
&& make install
# Install libgeotiff
RUN cd /build_deps \
&& wget --no-check-certificate https://download.osgeo.org/geotiff/libgeotiff/libgeotiff-1.7.1.tar.gz \
&& tar -zxf libgeotiff-1.7.1.tar.gz \
&& cd libgeotiff-1.7.1 \
&& mkdir -p build && cd build \
&& cmake .. \
&& make \
&& make install
# Install GDAL
RUN cd /build_deps \
&& git clone --depth 1 --branch v3.5.0alpha1 https://github.com/OSGeo/gdal.git && cd gdal \
&& ./autogen.sh \
&& ./configure --with-crypto=no --with-curl=yes --with-netcdf=yes \
&& make -j$(nproc) \
&& make install
# Install Cython, Rasterio, and Fiona
RUN cd /build_deps && pip3 install cython rasterio fiona shapely pyproj
# Install Mapserver
RUN cd /build_deps \
&& git clone https://github.com/mapserver/mapserver.git && cd mapserver \
&& git checkout rel-7-6-4 \
&& mkdir -p build && cd build \
&& cmake .. -DWITH_GIF=OFF -DWITH_HARFBUZZ=OFF -DWITH_PROTOBUFC=OFF -DWITH_FRIBIDI=OFF -DWITH_POSTGIS=ON -DWITH_GEOS=OFF -DWITH_FCGI=ON -DWITH_CAIRO=OFF \
&& make install
# Clean up
RUN cd /tmp && rm -r /build_deps
WORKDIR /work
# http://www.inanzzz.com/index.php/post/rhsb/running-apache-server-as-foreground-on-ubuntu-with-dockerfile
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOCK_DIR /var/lock/apache2
ENV APACHE_LOG_DIR /var/log/apache2
ENV APACHE_PID_FILE /var/run/apache2/apache2.pid
ENV APACHE_SERVER_NAME localhost
#RUN groupadd -r www-data && useradd -r --create-home -g www-data www-data
# install httpd runtime dependencies
# https://httpd.apache.org/docs/2.4/install.html#requirements
RUN apt-get update && apt-get -y install apache2 libapache2-mod-fcgid libapache2-mod-php php-common php-cli php-fpm php && \
ls /etc/apache2/mods-available && \
ls /etc/apache2/mods-enabled && \
a2enmod actions proxy_fcgi setenvif cgi fcgid rewrite && \
a2enconf php7.4-fpm serve-cgi-bin && \
RUN curl -LOk https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_admin_0_countries.zip \
&& curl -LOk https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_admin_1_states_provinces_lines.zip \
&& curl -LOk https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/physical/ne_10m_lakes.zip \
&& curl -LOk https://www2.census.gov/geo/tiger/GENZ2018/shp/cb_2018_us_county_500k.zip \
&& curl -LOk https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/physical/ne_10m_graticules_1.zip \
&& curl -LOk https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/physical/ne_10m_graticules_5.zip \
&& curl -LOk https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/physical/ne_10m_graticules_10.zip \
&& mkdir -p /work/shapefiles \
&& unzip -d /work/shapefiles ne_10m_admin_0_countries.zip \
&& unzip -d /work/shapefiles ne_10m_admin_1_states_provinces_lines.zip \
&& unzip -d /work/shapefiles ne_10m_lakes.zip \
&& unzip -d /work/shapefiles cb_2018_us_county_500k.zip \
&& unzip -d /work/shapefiles ne_10m_graticules_1.zip \
&& unzip -d /work/shapefiles ne_10m_graticules_5.zip \
&& unzip -d /work/shapefiles ne_10m_graticules_10.zip \
&& chmod a+r /work/shapefiles/* \
&& rm -f ne_*.zip cb_*.zip
# Install Fonts for mapserver labels
RUN echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections \
&& mkdir -p /work/mapfiles \
&& apt-get -y update && apt-get install -y ttf-mscorefonts-installer \
&& bash -c 'for font_fn in `find /usr/share/fonts/truetype/ -name "*.ttf"`; do font_name=`basename $font_fn`; font_name=${font_name/.ttf/}; font_name=${font_name,,}; echo "$font_name $font_fn" >> /work/mapfiles/fonts.list; done' \
&& apt-get -y clean \
&& rm -rf /var/lib/apt/lists/*
COPY site-conf /etc/apache2/sites-available/cspp_geo.conf
# disable the default which would conflict with our custom
RUN a2ensite cspp_geo && a2dissite 000-default
COPY cgi-bin/* /usr/lib/cgi-bin/
# Trick apache log to stdout/stderr
RUN ln -sf /dev/stdout /var/log/apache2/access.log && \
ln -sf /dev/stderr /var/log/apache2/error.log
# Point apache to the mapserver binary
RUN ln -s /usr/local/bin/mapserv /usr/lib/cgi-bin/mapserv && \
ln -s /usr/local/bin/mapserv /usr/lib/cgi-bin/mapserv.fcgi && \
chown ${APACHE_RUN_USER}:${APACHE_RUN_GROUP} /usr/lib/cgi-bin/* && \
chown -h ${APACHE_RUN_USER}:${APACHE_RUN_GROUP} /usr/lib/cgi-bin/*
RUN pip3 install jinja2 psycopg2 && rm -r /root/.cache/pip
COPY render.py run.sh abi_l1b_template.map /work/
COPY mapfiles/ /work/mapfiles/
COPY html/ /var/www/html/
COPY default_settings.yaml /work/geosphere_settings.yaml
# Add our own custom EPSG codes (HACK)
# GOES-16 ABI Full Disk = EPSG:930916
# GOES-17 ABI Full Disk = EPSG:930917
COPY sql/ /work/sql/
RUN sqlite3 -bail /usr/local/share/proj/proj.db < /work/sql/goesr_crs.sql
# Check the config before we finish
RUN apache2ctl configtest
# https://httpd.apache.org/docs/2.4/stopping.html#gracefulstop
STOPSIGNAL WINCH
EXPOSE 80