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.11
- Image configured with non-
root
user (calitp
by default) nginx
configured as a reverse proxy listening on container port8000
gunicorn
configured as a WSGI application server, communicates withnginx
over Unix socketgunicorn
default configuration location in$GUNICORN_CONF
gettext
for use with web frameworks like DjangoWORKDIR
set to/home/$USER/app
;gunicorn
configuration in/home/$USER/run
- Bring Your Own Web Framework
- see
benefits
for aDjango
example - see
eligibility-server
for aFlask
example
- see
- Bring Your Own
CMD
: drop in tobash
with 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:main
Development 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 app
Then, with the Remote - Containers extension enabled, open the folder containing this repository inside Visual Studio Code.