Public | Automated Build

Last pushed: a year ago
Short Description
Convox base image for Django
Full Description

convox/django

Convox base image for Django

Usage

FROM convox/django

# copy only the files needed for pip install
COPY requirements.txt /app/requirements.txt
RUN pip3 install --upgrade pip
RUN pip3 install -r requirements.txt

# copy only the files needed for collectstatic
COPY exampleapp/static /app/exampleapp/static
COPY exampleproject /app/exampleproject
COPY manage.py /app/manage.py
RUN python3 manage.py collectstatic --noinput

# copy the rest of the app
COPY . /app

Expectations

Applications using this image should:

  • Copy their source files into /app
  • Listen for HTTP requests on port 8000.
  • Set PROJECT to the django project name so gunicorn can find the WSGI callable

Exports

  • Listen for HTTP request on port 4000 and redirect all requests to https://.
  • Listen for HTTP requests on port 4001 accepting PROXY protocol and injecting X-Forwarded-For headers.

Example Configuration

When using this image, your docker-compose.yml should include the following:

labels:
  - convox.port.443.protocol=tls
  - convox.port.443.proxy=true
ports:
  - 80:4000
  - 443:4001

Includes

Base Image: convox/python

Standard Python development headers

  • libmysqld-dev
  • libpq-dev
  • libsqlite3-dev
  • python3-dev

nginx

  • Buffer incoming HTTP requests
  • Accept PROXY protocol headers to discover source IP
  • Inject X-Forwarded-Proto and X-Forwarded-For
  • Serve /static from disk without hitting the Django app

gunicorn

  • Run Django in production
Docker Pull Command
Owner
convox
Source Repository

Comments (0)