A base Docker image for Cal-ITP Python web applications.
Read the full documentation online: https://docs.calitp.org/docker-python-web
- Base image
python:3.12 - Image configured with non-
rootuser (calitpby default) nginxconfigured as a reverse proxy listening on container port8000gunicornconfigured as a WSGI application server, communicates withnginxover Unix socketgunicorndefault configuration location in$GUNICORN_CONFgettextfor use with web frameworks like DjangoWORKDIRset to/home/$USER/app;gunicornconfiguration in/home/$USER/run
- Bring Your Own Web Framework
- see
benefitsfor aDjangoexample - see
eligibility-serverfor aFlaskexample
- see
- Bring Your Own
CMD: drop in tobashwith the defaultENTRYPOINT.
Reference one of the image:tag from GitHub Container Registry in a Dockerfile. E.g. for the main branch:
FROM ghcr.io/cal-itp/docker-python-web:main
COPY my_app my_app
CMD "nginx && python -m gunicorn -c $GUNICORN_CONF my_app.wsgi"Or from the command line:
docker pull ghcr.io/cal-itp/docker-python-web:mainDevelopment for this repo is done within a Visual Studio Code devcontainer.
You must build the base Docker image cal-itp/docker-python-web:app before running the devcontainer. In a terminal, run:
docker compose build appThen, with the Remote - Containers extension enabled, open the folder containing this repository inside Visual Studio Code.