Skip to content

Commit

Permalink
#1 use uwsgi direct from Debian i.s.o. Python PyPi
Browse files Browse the repository at this point in the history
  • Loading branch information
justb4 committed Jun 2, 2024
1 parent 63f62d0 commit dab2d01
Show file tree
Hide file tree
Showing 8 changed files with 1,463 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: justb4/mapproxy
tags: latest,2.0.2-2
tags: latest,2.0.2-3
tag_with_ref: false
tag_with_sha: false
12 changes: 6 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ FROM python:3.11-slim-bookworm
# * upgrade Base image to python:3.11-slim-bookworm
# * drop support for EPSG:900913
# * patch TMS demo HTML
# * uwsgi from python3-uwsgi i.s.o. PyPi/pip: no build deps needed!
# * ENV settings: PROJ_DATA and PYTHONPATH

LABEL original_developer="Arne Schubert <[email protected]>"
LABEL contributor="Just van den Broecke <[email protected]>"
Expand All @@ -40,14 +42,13 @@ ENV MAPPROXY_PROCESSES="4" \
UWSGI_EXTRA_OPTIONS="" \
DEBIAN_FRONTEND="noninteractive" \
PROJ_DATA="/usr/share/proj" \
PYTHONPATH="/usr/lib/python3/dist-packages" \
DEB_BUILD_DEPS="build-essential libpcre2-dev" \
DEB_PACKAGES="python3-pil python3-yaml python3-pyproj libgeos-dev python3-lxml libgdal-dev python3-shapely libxml2-dev libxslt-dev uwsgi-plugin-python3 ${ADD_DEB_PACKAGES}" \
PIP_PACKAGES="uwsgi requests geojson watchdog MapProxy==${MAPPROXY_VERSION} ${ADD_PIP_PACKAGES}"
PYTHONPATH="/usr/lib/python3/dist-packages:/usr/local/lib/python3.11/site-packages" \
DEB_PACKAGES="python3-pil python3-yaml python3-pyproj libgeos-dev python3-lxml libgdal-dev python3-shapely libxml2-dev libxslt-dev uwsgi uwsgi-plugin-python3 ${ADD_DEB_PACKAGES}" \
PIP_PACKAGES="requests geojson watchdog MapProxy==${MAPPROXY_VERSION} ${ADD_PIP_PACKAGES}"

RUN set -x \
&& apt update \
&& apt install --no-install-recommends -y ${DEB_BUILD_DEPS} ${DEB_PACKAGES} ${ADD_DEB_PACKAGES} \
&& apt install --no-install-recommends -y ${DEB_PACKAGES} ${ADD_DEB_PACKAGES} \
&& useradd -ms /bin/bash mapproxy \
&& mkdir -p /mapproxy \
&& chown mapproxy /mapproxy \
Expand All @@ -56,7 +57,6 @@ RUN set -x \
&& pip3 uninstall --yes wheel \
&& pip3 cache purge \
&& ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime \
&& apt-get remove --yes --purge ${DEB_BUILD_DEPS} \
&& apt-get --yes --purge autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
Expand Down
23 changes: 17 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
![GitHub release](https://img.shields.io/github/release/justb4/docker-mapproxy.svg)
![Docker Pulls](https://img.shields.io/docker/pulls/justb4/mapproxy.svg)

MapProxy Docker Image from the [YAGA Development-Team](https://yagajs.org).
MapProxy Docker Image from the [YAGA Development-Team](https://github.com/yagajs).
Adapted by [justb4](https://github.com/justb4) to latest MP version, small Docker image and extended examples.
Find image on [Docker Hub](https://hub.docker.com/repository/docker/justb4/mapproxy).

Expand Down Expand Up @@ -35,8 +35,8 @@ docker run -v /path/to/mapproxy:/mapproxy -p 8080:8080 justb4/mapproxy
*It is optional, but recommended to add a volume. Within the volume mapproxy get the configuration, or create one
automatically. Cached tiles will be stored also into this volume.*

The container normally runs in [http-socket-mode](http://uwsgi-docs.readthedocs.io/en/latest/HTTP.html). If you will not
run the image behind a HTTP-Proxy, like [Nginx](http://nginx.org/), you can run it in direct http-mode by running:
The container normally runs in [http-socket-mode](http://uwsgi-docs.readthedocs.io/en/latest/HTTP.html). If you are not
running the image behind an HTTP-Proxy, like [Nginx](http://nginx.org/), you should run it in direct `http-mode` by running:

```bash
docker run -v /path/to/mapproxy:/mapproxy -p 8080:8080 justb4/mapproxy mapproxy http
Expand All @@ -48,9 +48,20 @@ docker run -v /path/to/mapproxy:/mapproxy -p 8080:8080 justb4/mapproxy mapproxy
* `MAPPROXY_THREADS` default: 2
* `UWSGI_EXTRA_OPTIONS` extra `uwsgi` commandline options e.g. `"--disable-logging --stats 0.0.0.0:9191"`, default empty

### Run as local user

In some cases, especially when using mounted volumes, you may get permission issues on directories and (log-) files.
You can also have the Docker Container run as your local user (id) i.s.o. `mapproxy`. But never run as user root!

In a `docker-compose.yml` you may set: `user: ${HOST_UID_GID}`. This env var can be generated: `export HOST_UID_GID="$(id -u):$(id -g)"`, in your
local environment or a start script.

See the [docker-compose.yml in examples/standard](examples/standard/docker-compose.yml) and
[start.sh there](examples/standard/start.sh).

## Seeding

The image also allows arbitrary commands like seeding:
The image also allows arbitrary commands like for seeding:

```bash

Expand Down Expand Up @@ -93,7 +104,7 @@ setuptools: None
You can put a `mapproxy.yaml` into the `/docker-entrypoint-initmapproxy.d` folder on the image. On startup this will be
used as MapProxy configuration. Attention, this will override an existing configuration in the volume!

Additional you can put shell-scripts, with `.sh`-suffix in that folder. They get executed on container startup.
In addition, you can put shell-scripts, with `.sh`-suffix in that folder. They get executed on container startup.

You should use the `mapproxy` user within the container, especially not `root`!

Expand All @@ -105,7 +116,7 @@ You are invited to contribute new features, fixes, or updates, large or small; w
requests, and do our best to process them as fast as we can.

Before you start to code, we recommend discussing your plans through a
[GitHub issue](https://github.com/yagajs/docker-mapproxy/issues), especially for more ambitious contributions.
[GitHub issue](https://github.com/justb4/docker-mapproxy/issues), especially for more ambitious contributions.
This gives other contributors a chance to point you in the right direction, give you feedback on your design, and help
you find out if someone else is working on the same thing.

Expand Down
Loading

0 comments on commit dab2d01

Please sign in to comment.