Skip to content

Commit

Permalink
Merge pull request MapServer#59 from NieuwlandGeo/docker
Browse files Browse the repository at this point in the history
Docker
  • Loading branch information
yjacolin authored Oct 21, 2019
2 parents 733bf56 + 25d692a commit a0c720d
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
boundaries.sql
osm-*.map
osm-*.log
*.mk
!docker.mk
1 change: 1 addition & 0 deletions data/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
README
land_polygons.*
simplified_land_polygons.*
*.pbf
18 changes: 18 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: '2'
services:
postgis:
build:
context: docker/postgis
# enable for local debug
# ports:
# - "5432:5432"
volumes:
- ".:/app"
webserver:
depends_on: [postgis]
build:
context: docker/webserver
ports:
- "80:80"
volumes:
- ".:/app"
7 changes: 7 additions & 0 deletions docker.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
OSM_DB_CONNECTION=host=postgis dbname=osm user=osm password=osm port=5432
OSM_PREFIX=osm_
OSM_FORCE_POSTGIS_EXTENT=1
OSM_WMS_SRS=EPSG:900913 EPSG:4326 EPSG:3857 EPSG:28992
PROJ_LIB=/usr/share/proj/

include Makefile
29 changes: 29 additions & 0 deletions docker/postgis/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM camptocamp/postgres:10

ARG USER_ID=1000

RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
sudo

RUN groupadd nopwsudo \
&& echo "%nopwsudo ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/nopwsudo \
&& useradd mapserveruser -u ${USER_ID} -G nopwsudo,sudo,adm -m

RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
git make build-essential python wget unzip mapserver-bin cgi-mapserver

RUN mkdir /app \
&& chown -R mapserveruser /app

# install imposm3
RUN wget -O imposm3.tgz 'https://github.com/omniscale/imposm3/releases/download/v0.6.0-alpha.4/imposm-0.6.0-alpha.4-linux-x86-64.tar.gz'
RUN tar --strip-components 1 -xzf imposm3.tgz -C /opt
RUN ln -s /opt/imposm /usr/local/bin/imposm

ADD initdb.sh /docker-entrypoint-initdb.d/initdb.sh

WORKDIR /app

ENV POSTGRES_USER osm
6 changes: 6 additions & 0 deletions docker/postgis/initdb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
set -e

psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
CREATE EXTENSION postgis;
EOSQL
15 changes: 15 additions & 0 deletions docker/webserver/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM debian:stretch

RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
mapserver-bin cgi-mapserver apache2 libapache2-mod-fcgid \
git make build-essential python wget unzip

RUN a2enmod alias fcgid cgid

ADD run-httpd.sh /run-httpd.sh
RUN chmod -v +x /run-httpd.sh

WORKDIR /app

CMD ["/run-httpd.sh"]
7 changes: 7 additions & 0 deletions docker/webserver/run-httpd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh
set -e

# Apache gets grumpy about PID files pre-existing
rm -f /usr/local/apache2/logs/httpd.pid

exec apache2ctl -DFOREGROUND

0 comments on commit a0c720d

Please sign in to comment.