Skip to content

Latest commit

 

History

History
56 lines (36 loc) · 1.81 KB

README.md

File metadata and controls

56 lines (36 loc) · 1.81 KB

docker-python-web

A base Docker image for Cal-ITP Python web applications.

Read the full documentation online: https://docs.calitp.org/docker-python-web

Features

  • Base image python:3.11
  • Image configured with non-root user (calitp by default)
  • nginx configured as a reverse proxy listening on container port 8000
  • gunicorn configured as a WSGI application server, communicates with nginx over Unix socket
  • gunicorn default configuration location in $GUNICORN_CONF
  • gettext for use with web frameworks like Django
  • WORKDIR set to /home/$USER/app; gunicorn configuration in /home/$USER/run

Non-Features

  • Bring Your Own Web Framework
  • Bring Your Own CMD: drop in to bash with the default ENTRYPOINT.

Usage

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

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.

License

Apache 2.0