-
David Hoese authored4a53fb6c
Dockerfile 5.38 KiB
FROM tiledb/tiledb-geospatial:latest
WORKDIR /work
# FIXME: Remove once added to parent image
RUN pip3 install shapely
RUN apt-get -y update && \
apt-get -y upgrade && \
apt-get -y install gcc g++ cmake sqlite3 libsqlite3-dev pkg-config bash-completion curl subversion && \
apt-get -y clean
# FIXME: Remove if/when upstream image builds with fcgi
# Install Mapserver (unstable)
RUN mkdir -p /build_deps && cd /build_deps \
&& apt-get -y update \
# && apt-get install -y libprotobuf17 zlib1g-dev libpng-dev libjpeg-turbo8 libfreetype6 libfribidi-dev libharfbuzz-dev libcairo2-dev libfcgi-dev libgeos++-dev postgresql postgis libxml2-dev libgif-dev libjpeg-turbo8-dev libprotobuf-dev protobuf-compiler libprotobuf-c-dev libprotobuf-c1 libprotobuf-dev protobuf-c-compiler \
&& apt-get install -y zlib1g-dev libpng-dev libjpeg-turbo8 libfreetype6 libfribidi-dev libharfbuzz-dev libcairo2-dev libfcgi-dev libgeos++-dev postgresql postgis libxml2-dev libgif-dev libjpeg-turbo8-dev libprotobuf-dev protobuf-compiler libprotobuf-c-dev libprotobuf-c1 libprotobuf-dev protobuf-c-compiler \
&& apt-get -y clean \
&& git clone https://github.com/mapserver/mapserver.git && cd mapserver \
&& git checkout 0fcc810f0b559c800f950db78a79fa6574799f23 \
&& mkdir -p build && cd build \
&& cmake .. -DWITH_PROTOBUFC=OFF -DWITH_POSTGIS=OFF \
&& make -j$(nproc) \
&& make install
# apache
# 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 cd /build_deps && apt-get -y install apache2 libapache2-mod-fcgid && \
ls /etc/apache2/mods-available && \
ls /etc/apache2/mods-enabled && \
apt-get -y install libapache2-mod-php7.2 php7.2-common php7.2-cli php7.2-fpm php7.2 && \
a2enmod actions proxy_fcgi setenvif cgi fcgid rewrite && \
a2enconf php7.2-fpm serve-cgi-bin && \
apt-get -y clean && \
rm -rf /var/lib/apt/lists/*
RUN apt-get -y update && apt-get install -y unzip \
&& 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 \
&& apt-get -y clean \
&& rm -rf /var/lib/apt/lists/*
# 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/
# 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
COPY render.py run.sh abi_l1b_template.map /work/
COPY mapfiles/ /work/mapfiles/
COPY html/ /var/www/html/
# 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 -init /work/sql/goesr_crs.sql /usr/local/share/proj/proj.db
# Check the config before we finish
RUN apache2ctl configtest
# https://httpd.apache.org/docs/2.4/stopping.html#gracefulstop
STOPSIGNAL WINCH
EXPOSE 80
CMD ["/work/run.sh"]