Add support for Docker.

This pull requests adds support to let map-machine run in a container. The added `Dockerfile` is a first running version, which has room for improvement, e.g. do not run the processes as root and use a virtual env, reduce image size by cleaning up apt cache. The `.dockerignore` ignores copying files to the container, which are not needed.

The docker build and an example call can look like this:

```
docker build -t strubbl_mapmachine .
docker run -v /data/mapmachine/maps:/maps strubbl_mapmachine render --cache /maps/cache -z 18 -o /maps/wentorf.svg -b 10.2445866411,53.4858307519,10.2726961915,53.4981753961
```
This commit is contained in:
Sven Fischer 2022-01-31 20:33:18 +01:00
parent de8be46648
commit 3f52cf2022
2 changed files with 20 additions and 0 deletions

4
.dockerignore Normal file
View file

@ -0,0 +1,4 @@
Dockerfile
.git/
tests/

16
Dockerfile Normal file
View file

@ -0,0 +1,16 @@
FROM python:3.9-slim-bullseye
WORKDIR /app
COPY . /app/
RUN \
apt update && \
apt install -y --no-install-recommends gcc libcairo2-dev libgeos-dev && \
pip install --upgrade pip && \
pip install . && \
mkdir -p /maps/cache
VOLUME ["/maps"]
ENTRYPOINT ["map-machine"]