{"id":13424570,"url":"https://github.com/PDOK/mapserver-docker","last_synced_at":"2025-03-15T18:35:26.417Z","repository":{"id":38601184,"uuid":"132135629","full_name":"PDOK/mapserver-docker","owner":"PDOK","description":"Mapserver OGR GDAL PostGIS WMS WCS WFS with Lighttpd in Docker","archived":false,"fork":false,"pushed_at":"2025-02-24T16:31:38.000Z","size":2702,"stargazers_count":35,"open_issues_count":1,"forks_count":16,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-02-24T17:42:26.873Z","etag":null,"topics":["docker-image","gdal","lighttpd","mapserver","ogc","ogr","pdok","postgis","wcs","wfs","wms"],"latest_commit_sha":null,"homepage":"https://hub.docker.com/r/pdok/mapserver","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PDOK.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-04T12:10:56.000Z","updated_at":"2025-01-07T13:45:33.000Z","dependencies_parsed_at":"2023-01-22T02:51:36.799Z","dependency_job_id":"1c31eeb0-c6f9-492d-8824-b7335eb61223","html_url":"https://github.com/PDOK/mapserver-docker","commit_stats":null,"previous_names":[],"tags_count":43,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PDOK%2Fmapserver-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PDOK%2Fmapserver-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PDOK%2Fmapserver-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PDOK%2Fmapserver-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PDOK","download_url":"https://codeload.github.com/PDOK/mapserver-docker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243775878,"owners_count":20346281,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker-image","gdal","lighttpd","mapserver","ogc","ogr","pdok","postgis","wcs","wfs","wms"],"created_at":"2024-07-31T00:00:56.368Z","updated_at":"2025-03-15T18:35:21.384Z","avatar_url":"https://github.com/PDOK.png","language":"Dockerfile","readme":"# Mapserver docker\n\n[![GitHub\nlicense](https://img.shields.io/github/license/PDOK/mapserver-docker)](https://github.com/PDOK/mapserver-docker/blob/master/LICENSE)\n[![GitHub\nrelease](https://img.shields.io/github/release/PDOK/mapserver-docker.svg)](https://github.com/PDOK/mapserver-docker/releases)\n[![Docker\nPulls](https://img.shields.io/docker/pulls/pdok/mapserver.svg)](https://hub.docker.com/r/pdok/mapserver)\n\n[Mapserver](https://mapserver.org/) [Docker](https://www.docker.com/) image\nusing [lighttpd](https://www.lighttpd.net/) build with\n[GDAL/OGR](https://gdal.org/), [PostGIS](https://postgis.net/) to serve out WMS,\nWFS and WCS services.\n\n## TL;DR\n\n### docker build\n\n```shell\ndocker build -t pdok/mapserver .\n```\n\n### docker run wms\n\n```shell\ndocker run -e MS_MAPFILE=/srv/data/example.map -e SERVICE_TYPE=WMS  --rm -d \\\n            -p 80:80 --name mapserver-example -v `pwd`/example:/srv/data pdok/mapserver \n```\n\n### docker run wfs\n\n```shell\ndocker run -e MS_MAPFILE=/srv/data/example.map -e SERVICE_TYPE=WFS  --rm -d \\\n            -p 80:80 --name mapserver-example -v `pwd`/example:/srv/data pdok/mapserver \n```\n\n### docker stop\n\n```shell\ndocker stop mapserver-example\n```\n\n## Introduction\n\nThis project aims to fulfill two needs:\n\n1. create [OGC services](http://www.opengeospatial.org/standards) that are\n   deployable on a scalable infrastructure.\n2. create a useable [Docker](https://www.docker.com) base image.\n\nFulfilling the first need the main purpose is to create an Docker base image\nthat can be run on a platform like [Kubernetes](https://kubernetes.io/).\n\nRegarding the second need, finding a usable\n[Mapserver](https://github.com/mapserver/mapserver) Docker image is a challenge.\nMost images expose the \u0026map=... QUERY_STRING in the GetCapabilities, don't run\nin FastCGI and are based on Apache.\n\n## What will it do\n\nIt will create an Mapserver application that runs through\n[lighttpd](https://www.lighttpd.net/). With lua scripting the map=...\nQUERY_STRING is filter from incoming request. In other words the used Mapfile\ncan only be set with an ENV.\n\nThe included EPSG file containing the projection parameters only contains a\nsmall set of available EPSG code, namely the once used by our organization. If\none wants to use additional EPSG projections one can overwrite this file.\n\n## Docker image\n\nThe Docker image contains 2 stages:\n\n1. builder\n2. service\n\n### builder\n\nThe builder stage compiles Mapserver. The Dockerfile contains all the available\nMapserver build option explicitly, so it is clear which options are enabled and\ndisabled.\n\n### service\n\nThe service stage copies the Mapserver application, build in the first stage to\nthe service stage, and configures lighttpd\n\n## Usage\n\n### Build\n\n```shell\ndocker build -t pdok/mapserver .\n```\n\nFor a specific Dutch version which includes a specific (and smaller) epsg file\nand necessary grid corrections files.\n\n```shell\ndocker build -t pdok/mapserver:nl -f Dockerfile.NL .\n```\n\n### Run\n\nThis image can be run straight from the command-line. A  volume needs to be\nmounted on the container directory `/srv/data`. The mounted volume needs to\ncontain a mapserver `*.map` file that matches the `MS_MAPFILE` env var.\n\n```shell\ndocker run \\\n   --rm -d \\\n   -e MS_MAPFILE=/srv/data/example.map \\\n   -p 80:80 \\\n   --name mapserver-example \\\n   -v `pwd`/example:/srv/data \\\n   pdok/mapserver\n```\n\nRunning the example above will create a service on the url\n\u003chttp://localhost/mapserver?REQUEST=GetCapabilities\u0026SERVICE=WMS\u003e that will\naccept something like a ([GetMap\nrequest](http://localhost/mapserver?SERVICE=WMS\u0026VERSION=1.3.0\u0026REQUEST=GetMap\u0026BBOX=50,2.423859315589366403,54,9\u0026CRS=EPSG:4326\u0026WIDTH=1648\u0026HEIGHT=1002\u0026LAYERS=example\u0026STYLES=\u0026FORMAT=image/png\u0026DPI=96\u0026MAP_RESOLUTION=96\u0026FORMAT_OPTIONS=dpi:96\u0026TRANSPARENT=TRUE)).\n\nThe environment variables that can be set are the following:\n\n- `DEBUG`\n- `MIN_PROCS`\n- `MAX_PROCS`\n- `MAX_LOAD_PER_PROC`\n- `IDLE_TIMEOUT`\n- `MS_MAPFILE`\n- `PROJ_LIB`\n\nThe environment variables, with the exception of `MS_MAPFILE` have a default\nvalue set in the [`Dockerfile`](./Dockerfile).\n\nThe [GDAL](https://gdal.org/) `PROJ_LIB` env var is default set with the value\n`/usr/share/proj`. For performance reasons one would like to set a custom\n`PROJ_LIB` containing a minimum of available EPSG codes. This can be done with\nthe mentioned `PROJ_LIB` env var.\n\n```shell\ndocker run \\\n   --rm -d \\\n   -p 80:80 \\\n   --name mapserver-run-example \\\n   -v `pwd`/example:/srv/data \\\n   -e DEBUG=0 \\\n   -e MIN_PROCS=1 \\\n   -e MAX_PROCS=3 \\\n   -e MAX_LOAD_PER_PROC=4 \\\n   -e IDLE_TIMEOUT=20 \\\n   -e MS_MAPFILE=/srv/data/example.map \\\n   pdok/mapserver\n```\n\n## Projections\n\nAltering the proj file is done for different reasons, adding custom projections\nor removing 'unused' ones for better performance. This can be done in a couple\nof ways through this setup.\n\n### base image\n\nThe best example for this is the [Dockerfile.NL](/Dockerfile.NL) in this\nrepository. This Dockerfile uses the main Dockerfile as a base image copies\nspecific geodetic grid files and overwrites the default espg with a tuned one\nfor the Netherlands.\n\nA good resource for these geodetic files is the [PROJ.org Datumgrid\nCDN](https://cdn.proj.org/).\n\n### volume\n\nAnother option is to create a proj file (like in the [`nl`](/nl) folder) and\nmount this to the container and set the `PROJ_LIB` env var to that location by\nadding the following parameters to the docker command:\n\n```sh\n-e PROJ_LIB=/my-custom-proj-dir \\\n-v `pwd`/path/to/proj/dir:/my-custom-proj-dir \\\n```\n\n## Example\n\nWhen starting the container it will create a WMS \u0026 WFS service on the\naccespoint: `http://localhost/mapserver`.\n\n### Example requests\n\n#### WMS\n\nExample requests when the container is run as WMS service\n\n- [`http://localhost/mapserver?SERVICE=WMS\u0026REQUEST=GetCapabilities`](http://localhost/mapserver?SERVICE=WMS\u0026REQUEST=GetCapabilities)\n- [`http://localhost/mapserver?SERVICE=WMS\u0026VERSION=1.3.0\u0026REQUEST=GetMap\u0026BBOX=50,2,54,9\u0026CRS=EPSG:4326\u0026WIDTH=905\u0026HEIGHT=517\u0026LAYERS=example\u0026STYLES=\u0026FORMAT=image/png\u0026DPI=96\u0026MAP_RESOLUTION=96\u0026FORMAT_OPTIONS=dpi:96\u0026TRANSPARENT=TRUE`](http://localhost/mapserver?SERVICE=WMS\u0026VERSION=1.3.0\u0026REQUEST=GetMap\u0026BBOX=50,2,54,9\u0026CRS=EPSG:4326\u0026WIDTH=905\u0026HEIGHT=517\u0026LAYERS=example\u0026STYLES=\u0026FORMAT=image/png\u0026DPI=96\u0026MAP_RESOLUTION=96\u0026FORMAT_OPTIONS=dpi:96\u0026TRANSPARENT=TRUE)\n- [`http://localhost/mapserver?SERVICE=WMS\u0026VERSION=1.3.0\u0026REQUEST=GetFeatureInfo\u0026BBOX=48.9306039592783506,0.48758765231731171,55.46504193821721884,12.33319204541738756\u0026CRS=EPSG:4326\u0026WIDTH=1530\u0026HEIGHT=844\u0026LAYERS=example\u0026STYLES=\u0026FORMAT=image/png\u0026QUERY_LAYERS=example\u0026INFO_FORMAT=text/html\u0026I=389\u0026J=537\u0026FEATURE_COUNT=10`](http://localhost/mapserver?SERVICE=WMS\u0026VERSION=1.3.0\u0026REQUEST=GetFeatureInfo\u0026BBOX=48.9306039592783506,0.48758765231731171,55.46504193821721884,12.33319204541738756\u0026CRS=EPSG:4326\u0026WIDTH=1530\u0026HEIGHT=844\u0026LAYERS=example\u0026STYLES=\u0026FORMAT=image/png\u0026QUERY_LAYERS=example\u0026INFO_FORMAT=text/html\u0026I=389\u0026J=537\u0026FEATURE_COUNT=10)\n\n#### WFS\n\nExample requests when the container is run as WFS service\n\n- [`http://localhost/mapserver?SERVICE=WFS\u0026REQUEST=GetCapabilities`](http://localhost/mapserver?SERVICE=WFS\u0026REQUEST=GetCapabilities)\n- [`http://localhost/mapserver?SERVICE=WFS\u0026VERSION=2.0.0\u0026REQUEST=GetFeature\u0026TYPENAMES=example:example\u0026COUNT=1`](http://localhost/mapserver?SERVICE=WFS\u0026VERSION=2.0.0\u0026REQUEST=GetFeature\u0026TYPENAMES=example:example\u0026COUNT=1)\n\n## Misc\n\n### Why Lighttpd\n\nIn our previous configurations we would run [NGINX](https://www.nginx.com/),\nwhile this is a good web service and has a lot of configuration options, it runs\nwith multiple processes. There for we needed supervisord for managing this,\nwhereas [lighttpd](https://www.lighttpd.net/) runs as a single process. Also all\nthe routing configuration options aren't needed, because that is handled by the\ninfrastructure/platform, like [Kubernetes](https://kubernetes.io/). If one would\nlike to configure some simple routing is still can be done in the lighttpd.conf.\n\n### Used examples\n\n- \u003chttps://github.com/srounet/docker-mapserver\u003e\n- \u003chttps://github.com/Amsterdam/mapserver\u003e\n","funding_links":[],"categories":["Dockerfile"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPDOK%2Fmapserver-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FPDOK%2Fmapserver-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPDOK%2Fmapserver-docker/lists"}