Newer
Older
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
RUN apt-get update && apt-get install -y \
tzdata \
gcc \
g++ \
automake \
build-essential \
cmake \
libsqlite3-dev \
libjpeg-dev \
libjpeg-turbo8 \
libjpeg-turbo8-dev \
libpng-dev \
libfreetype6 \
libfreetype6-dev \
libzstd-dev \
pkg-config \
git \
wget \
curl \
libcurl4 \
libcurl4-openssl-dev \
zlib1g-dev \
libfribidi-dev \
libharfbuzz-dev \
libfcgi-dev \
libgeos++-dev \
libpq-dev \
libgif-dev \
&& rm -rf /var/lib/apt/lists/*
# Install libtiff
RUN mkdir -p /build_deps && cd /build_deps \
&& wget --no-check-certificate http://www.libtiff.org/downloads/tiff-4.6.0t.tar.gz \
&& tar -zxf tiff-4.6.0t.tar.gz \
&& cd tiff-4.6.0t \
&& ./configure \
&& make \
&& make install
# Install Proj
RUN cd /build_deps \
&& git clone https://github.com/OSGeo/PROJ.git -b 9.4.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://github.com/OSGeo/libgeotiff/releases/download/1.7.3/libgeotiff-1.7.3.tar.gz \
&& tar -zxf libgeotiff-1.7.3.tar.gz \
&& cd libgeotiff-1.7.3 \
&& mkdir -p build && cd build \
&& cmake .. \
&& make \
&& make install
# Install GDAL
RUN cd /build_deps \
&& git clone --depth 1 --branch v3.9.1 https://github.com/OSGeo/gdal.git && cd gdal \
&& mkdir build && cd build \
&& cmake -DGDAL_USE_INTERNAL_LIBS=OFF -DGDAL_USE_JSONC_INTERNAL=ON -DGDAL_USE_CURL=ON -DGDAL_USE_CRYPTOPP=OFF -DGDAL_USE_NETCDF=OFF .. \
&& cmake --build . \
&& cmake --build . --target install
# Install Mapserver
RUN cd /build_deps \
&& git clone https://github.com/mapserver/mapserver.git && cd mapserver \
&& 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 \
-DWITH_WFS=OFF -DWITH_WCS=OFF -DWITH_OGCAPI=OFF -DWITH_LIBXML2=OFF \
&& make install
COPY --from=build /usr/local/share/proj /usr/local/share/proj
RUN apt-get update && apt-get install -y sqlite3
# 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
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 and other runtime dependencies
# https://httpd.apache.org/docs/2.4/install.html#requirements
RUN apt-get update && apt-get -y install apache2 libapache2-mod-fcgid curl unzip python3-pip && \
ls /etc/apache2/mods-available && \
ls /etc/apache2/mods-enabled && \
a2enmod actions proxy_fcgi setenvif cgi fcgid rewrite && \
COPY --from=build /usr/local/bin /usr/local/bin
COPY --from=proj-update /usr/local/share/proj /usr/local/share/proj
COPY --from=build /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu
COPY --from=build /usr/local/lib/libgdal* /usr/local/lib/libproj* /usr/local/lib/libtiff* /usr/local/lib/libgeotiff* /usr/local/lib/libmapserver* /usr/local/lib/
RUN curl -LO -e https://www.naturalearthdata.com https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_admin_0_countries.zip \
&& curl -LO -e https://www.naturalearthdata.com https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_admin_1_states_provinces_lines.zip \
&& curl -LO -e https://www.naturalearthdata.com https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/physical/ne_10m_lakes.zip \
&& curl -LO -e https://www.naturalearthdata.com https://www2.census.gov/geo/tiger/GENZ2018/shp/cb_2018_us_county_500k.zip \
&& curl -LO -e https://www.naturalearthdata.com https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/physical/ne_10m_graticules_1.zip \
&& curl -LO -e https://www.naturalearthdata.com https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/physical/ne_10m_graticules_5.zip \
&& curl -LO -e https://www.naturalearthdata.com 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
# 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 python3 -m pip install --break-system-packages --root-user-action ignore jinja2 && rm -r /root/.cache/pip
COPY render.py run.sh abi_l1b_template.map /work/
COPY mapserver.conf /usr/local/etc/mapserver.conf
COPY mapfiles/ /work/mapfiles/
COPY html/ /var/www/html/
COPY default_settings.yaml /work/geosphere_settings.yaml
# Check the config before we finish
RUN apache2ctl configtest
# https://httpd.apache.org/docs/2.4/stopping.html#gracefulstop
STOPSIGNAL WINCH
EXPOSE 80