Skip to content
Snippets Groups Projects
Dockerfile 3.21 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/*

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 && \
    chown ${APACHE_RUN_USER}:${APACHE_RUN_GROUP} /usr/lib/cgi-bin/* && \
    chown -h ${APACHE_RUN_USER}:${APACHE_RUN_GROUP} /usr/lib/cgi-bin/*

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

# https://httpd.apache.org/docs/2.4/stopping.html#gracefulstop
STOPSIGNAL WINCH

EXPOSE 80
CMD ["/usr/sbin/apache2ctl", "-DFOREGROUND"]