Sign inSign up

matthieugouel/python-gunicorn-nginx

By matthieugouel

•Updated over 8 years ago

Docker image with Python3, Gunicorn and Nginx, managed with Supervisor

Image
0

8.0K

matthieugouel/python-gunicorn-nginx repository overview

⁠Docker Image : python-gunicorn-nginx

Build Status Docker Build Status Docker Automated build

This image contains Nginx and Gunicorn on top of Python3 docker image. These two software are managed with Supervisor.

⁠Usage

The entry point of your application must be named as run.py. Moreover, the instance in that file must be called app. Also, by default the worker class used is Gevent.

You can include a custom Gunicorn configuration file into your application. By default the configuration file must be name as gunicorn.config.py

⁠Dockerfile example

Here is an example of a Dockerfile using that image :

FROM matthieugouel/python-gunicorn-nginx:latest
MAINTAINER Matthieu Gouel

# Copy the application
COPY . /app

# Install application requirements
RUN pip install -U pip
RUN pip install -r /app/requirements.txt

There is also a Flask demo application in the app folder of this repository.

⁠Build and run

First, build your image based on your Dockerfile.

docker build -t prod_api .

Then, you can run a container like this :

docker run -p 127.0.0.1:8000:80 prod_api

And finally access it with curl for instance :

curl localhost:8000

Tag summary

Content type

Image

Digest

Size

272 MB

Last updated

over 8 years ago

docker pull matthieugouel/python-gunicorn-nginx