|
1 | | -*NOTE: These images are a fork or the repository [tiangolo/UWSGI-NGINX-DOCKER](https://github.com/tiangolo/uwsgi-nginx-docker). This fork was necessary because of an urgent need for changes and modifications, which are described below.* |
2 | | - |
3 | 1 | # Supported tags and `Dockerfile` links |
4 | 2 |
|
5 | | - - [`python2.7` _(Dockerfile)_](https://github.com/robertpeteuil/docker-nginx-uwsgi/blob/master/python2.7/Dockerfile) |
6 | | - - [`python2.7-alpine` _(Dockerfile)_](https://github.com/robertpeteuil/docker-nginx-uwsgi/blob/master/python2.7-alpine/Dockerfile) |
7 | | - - [`python3.5` _(Dockerfile)_](https://github.com/robertpeteuil/docker-nginx-uwsgi/blob/master/python3.5/Dockerfile) |
8 | | - - [`python3.5-alpine` _(Dockerfile)_](https://github.com/robertpeteuil/docker-nginx-uwsgi/blob/master/python3.5-alpine/Dockerfile) |
9 | | - - [`python3.6` _(Dockerfile)_](https://github.com/robertpeteuil/docker-nginx-uwsgi/blob/master/python3.6/Dockerfile) |
10 | | - - [`python3.6-alpine` _(Dockerfile)_](https://github.com/robertpeteuil/docker-nginx-uwsgi/blob/master/python3.6-alpine/Dockerfile) |
| 3 | +- `py2.7`, `python2.7` [_(python2.7/Dockerfile)_](https://github.com/robertpeteuil/docker-nginx-uwsgi/blob/master/python2.7/Dockerfile) |
| 4 | +- `py2.7-alpine`, `python2.7-alpine` [_(python2.7-alpine/Dockerfile)_](https://github.com/robertpeteuil/docker-nginx-uwsgi/blob/master/python2.7-alpine/Dockerfile) |
| 5 | +- `py3.5`, `python3.5` [_(python3.5/Dockerfile)_](https://github.com/robertpeteuil/docker-nginx-uwsgi/blob/master/python3.5/Dockerfile) |
| 6 | +- `py3.5-alpine`, `python3.5-alpine` [_(python3.5-alpine/Dockerfile)_](https://github.com/robertpeteuil/docker-nginx-uwsgi/blob/master/python3.5-alpine/Dockerfile) |
| 7 | +- `py3.6`, `python3.6` [_(python3.6/Dockerfile)_](https://github.com/robertpeteuil/docker-nginx-uwsgi/blob/master/python3.6/Dockerfile) |
| 8 | +- `py3.6-alpine`, `python3.6-alpine` [_(python3.6-alpine/Dockerfile)_](https://github.com/robertpeteuil/docker-nginx-uwsgi/blob/master/python3.6-alpine/Dockerfile) |
| 9 | + |
| 10 | +**You must explicitly use one of the tags above.** The `latest` tag is not assigned since each tag represents a different variant, not an incremental version. |
| 11 | + |
| 12 | +## NGINX-UWSGI |
| 13 | + |
| 14 | +**Docker** image with **Nginx**, **uWSGI** and **Python** running in a single container to enable running Python Web Apps on NGINX. |
| 15 | + |
| 16 | +**GitHub Repo**: <https://github.com/robertpeteuil/docker-nginx-uwsgi> |
| 17 | + |
| 18 | +**Docker Hub Images**: <https://hub.docker.com/r/robpco/nginx-uwsgi/> |
| 19 | + |
| 20 | +## Overview |
| 21 | + |
| 22 | +This Docker image allow the creation/migration of Python Web Apps to run on Nginx and uWSGI in a single container. It's designed for use as base image for: |
| 23 | + |
| 24 | +- Other images - such as a pre-built image for running Flask Apps [nginx-uwsgi-flask](https://github.com/robertpeteuil/docker-nginx-uwsgi-flask) . |
| 25 | +- A development image that can be customized with your unique web-framework, Python libraries and code. |
| 26 | + |
| 27 | +This repo auto-generates images to [Docker-Hub](https://hub.docker.com/r/robpco/nginx-uwsgi/). It includes standard and alpine-based variants for each supported Python version (2.7, 3.5, 3.6). |
| 28 | + |
| 29 | +## Usage |
11 | 30 |
|
12 | | -# Overview |
| 31 | +The Docker-Hub [repository](https://hub.docker.com/r/robpco/nginx-uwsgi/) contains auto-generated images from this repo. They can be referenced (or pulled) by using the image name `robpco/nginx-uwsgi`, plus a tag for the python version desired (ex: `:python3.6`), and optionally appending `-alpine` to the tag (for alpine variants). |
13 | 32 |
|
14 | | -**Docker** image with **Nginx**, **uWSGI** and **Python** running in a single container that enables easy migration of Python Web Apps to production on NGINX. They are designed as a base image, and do not have web-frameworks pre-installed. To use them, add your web-framework of choice (Flask, Django, etc..) and python application. |
| 33 | +## Custom Environment Variables |
15 | 34 |
|
16 | | -**For detailed information, examples and documentation visit tiangolo's [repo](https://github.com/tiangolo/uwsgi-nginx-docker).** |
| 35 | +This image supports the following custom environment variables: |
17 | 36 |
|
18 | | -# Changes |
| 37 | +- **UWSGI_INI** - the path and file of the configuration info |
| 38 | + - default: `/app/uwsgi.ini` |
| 39 | +- **NGINX_MAX_UPLOAD** - the maximum file upload size allowed by Nginx |
| 40 | + - 0 = unlimited (image default) |
| 41 | + - 1m = normal Nginx default |
| 42 | +- **LISTEN_PORT** - custom port that Nginx should listen on |
| 43 | + - 80 = Nginx default |
19 | 44 |
|
20 | | -These images include the following changes from the original repo: |
21 | | -- The addition of alpine-linux variants that are much smaller in size. |
22 | | -- `supervisord` enhancement to reduce CRIT errors |
23 | | - - `supervisord.conf` is explicitly referenced via the Dockerfile CMD statement |
24 | | - - `supervisord.conf` includes an explicitly set user-name (root) (which can be changed). |
25 | | -- Includes an updated version of Nginx (1.13.7) on non-alpine variants |
26 | | -- Includes updated python revisions for each supported version (2.7, 3.5, and 3.6) |
27 | | -- Adds LISTEN_PORT environment var to allow setting custom ports; via docker run, or docker-compose. |
| 45 | +## Setting Environment Variables |
28 | 46 |
|
29 | | -# Docker Hub Repository |
| 47 | +Environment variables can be set in multiple ways. The following examples, demonstrate setting the `LISTEN_PORT` environment variable via three different methods. These methods apply to the other Environment Variables as well. |
30 | 48 |
|
31 | | -The docker-hub [repository](https://hub.docker.com/r/robpco/nginx-uwsgi/) contains pre-built images. The images can be pulled by using the python version as a tag (or python version + "-alpine"). |
| 49 | +### Setting in a `Dockerfile` |
32 | 50 |
|
33 | | -```bash |
34 | | -docker pull robpco/nginx-uwsgi:python3.6-alpine |
| 51 | +```dockerfile |
| 52 | +# ... (snip) ... |
| 53 | +ENV LISTEN_PORT 8080 |
| 54 | +# ... (snip) ... |
35 | 55 | ``` |
36 | 56 |
|
37 | | -NOTE: They do NOT not support a `latest` tag, because they are different variants, not incremental versions. Using a `latest` tag with images of this sort can potentially lead to catastrophic results. |
| 57 | +### Setting during [`docker run`](https://docs.docker.com/engine/reference/commandline/run/#options) with the `-e` option |
| 58 | + |
| 59 | +```shell |
| 60 | +docker run -e LISTEN_PORT=8080 -p 8080:8080 myimage |
| 61 | +``` |
| 62 | + |
| 63 | +### Setting in `docker-compose` file using the `environment:` keyword in a `docker-compose` file |
| 64 | + |
| 65 | +```yml |
| 66 | +version: '2.2' |
| 67 | +services: |
| 68 | + web: |
| 69 | + image: myapp |
| 70 | + environment: |
| 71 | + LISTEN_PORT: 8080 |
| 72 | +``` |
| 73 | +
|
| 74 | +Inspired by the project at [tiangolo/UWSGI-NGINX-DOCKER](https://github.com/tiangolo/uwsgi-nginx-docker). |
| 75 | +
|
| 76 | +## UPDATES |
| 77 | +
|
| 78 | +- 2017-12-11: Added multiple tags per variant: `py3.6` is the same as `python3.6`, and so forth... |
| 79 | +- 2017-11-29: Added ability to change port Nginx listens on with new environment variable `LISTEN_PORT`. |
| 80 | + - Thanks to github user [tmshn](https://github.com/tmshn) |
| 81 | +- 2017-11-29: Alpine variants added |
| 82 | + - Thanks to github user [ProgEsteves](https://github.com/ProgEsteves) |
| 83 | +- 2017-11-29: Automatic image re-build when Python updates |
| 84 | +- 2017-11-28: Updated Nginx version installed on non-Alpine images |
| 85 | + |
| 86 | +## CHANGELOG |
| 87 | + |
| 88 | +- 2017-12-15: Fix to avoid duplicate listen entries in nginx.conf |
| 89 | +- 2017-11-30: Alpine images - eliminated uWSGI random build failures |
| 90 | +- 2017-11-30: Non-Alpine images - limit build failures caused by GPG key validation failing |
| 91 | +- 2017-11-29: Alpine required additional changes: |
| 92 | + - Replace default `/etc/nginx/nginx.conf` with an alternate version |
| 93 | + - Create `/run/nginx` directory to stop immediate Nginx crash |
| 94 | +- 2017-11-28: Fixed console errors from supervisor process: |
| 95 | + - Added explicit path reference to `supervisord.conf` in Dockerfile `CMD` statement |
| 96 | + - Added explicitly set username in `supervisord.conf` |
0 commit comments