From 4ebb7cfacf2f0b7847d83486a8d82b5994e0d857 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Mon, 27 Apr 2020 20:24:11 +0200 Subject: [PATCH 1/3] :sparkles: Add slim version --- .github/workflows/deploy.yml | 2 ++ .github/workflows/test.yml | 2 ++ docker-images/python3.8-slim.dockerfile | 24 ++++++++++++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 docker-images/python3.8-slim.dockerfile diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 8ca6f68c..66f4b8e0 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -18,6 +18,8 @@ jobs: python_version: "3.7" - name: python3.6 python_version: "3.6" + - name: python3.8-slim + python_version: "3.8" - name: python3.8-alpine3.10 python_version: "3.8" - name: python3.7-alpine3.8 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4d7923f7..abfe7c04 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,6 +18,8 @@ jobs: python_version: "3.7" - name: python3.6 python_version: "3.6" + - name: python3.8-slim + python_version: "3.8" - name: python3.8-alpine3.10 python_version: "3.8" - name: python3.7-alpine3.8 diff --git a/docker-images/python3.8-slim.dockerfile b/docker-images/python3.8-slim.dockerfile new file mode 100644 index 00000000..21b1b606 --- /dev/null +++ b/docker-images/python3.8-slim.dockerfile @@ -0,0 +1,24 @@ +FROM python:3.8-slim + +LABEL maintainer="Sebastian Ramirez " + +RUN pip install --no-cache-dir uvicorn gunicorn + +COPY ./start.sh /start.sh +RUN chmod +x /start.sh + +COPY ./gunicorn_conf.py /gunicorn_conf.py + +COPY ./start-reload.sh /start-reload.sh +RUN chmod +x /start-reload.sh + +COPY ./app /app +WORKDIR /app/ + +ENV PYTHONPATH=/app + +EXPOSE 80 + +# Run the start script, it will check for an /app/prestart.sh script (e.g. for migrations) +# And then will start Gunicorn with Uvicorn +CMD ["/start.sh"] From 5ef1b34cf519c40922c89b3c28dec58c8edb5d9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Mon, 27 Apr 2020 20:24:44 +0200 Subject: [PATCH 2/3] :white_check_mark: Test slim version --- scripts/process_all.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/process_all.py b/scripts/process_all.py index 12b084d9..a4a72146 100644 --- a/scripts/process_all.py +++ b/scripts/process_all.py @@ -7,6 +7,7 @@ {"NAME": "python3.8", "PYTHON_VERSION": "3.8"}, {"NAME": "python3.7", "PYTHON_VERSION": "3.7"}, {"NAME": "python3.6", "PYTHON_VERSION": "3.6"}, + {"NAME": "python3.8-slim", "PYTHON_VERSION": "3.8"}, {"NAME": "python3.8-alpine3.10", "PYTHON_VERSION": "3.8"}, {"NAME": "python3.7-alpine3.8", "PYTHON_VERSION": "3.7"}, {"NAME": "python3.6-alpine3.8", "PYTHON_VERSION": "3.6"}, From 80fee78e17de1007479af7b7edabb53cfee0e72d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Mon, 27 Apr 2020 20:25:05 +0200 Subject: [PATCH 3/3] :memo: Add docs and tags for slim version --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5013abe5..ffeab06e 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ * [`python3.8`, `latest` _(Dockerfile)_](https://github.com/tiangolo/uvicorn-gunicorn-docker/blob/master/docker-images/python3.8.dockerfile) * [`python3.7`, _(Dockerfile)_](https://github.com/tiangolo/uvicorn-gunicorn-docker/blob/master/docker-images/python3.7.dockerfile) * [`python3.6` _(Dockerfile)_](https://github.com/tiangolo/uvicorn-gunicorn-docker/blob/master/docker-images/python3.6.dockerfile) +* [`python3.8-slim` _(Dockerfile)_](https://github.com/tiangolo/uvicorn-gunicorn-docker/blob/master/docker-images/python3.8-slim.dockerfile) * [`python3.8-alpine3.10` _(Dockerfile)_](https://github.com/tiangolo/uvicorn-gunicorn-docker/blob/master/docker-images/python3.8-alpine3.10.dockerfile) * [`python3.7-alpine3.8` _(Dockerfile)_](https://github.com/tiangolo/uvicorn-gunicorn-docker/blob/master/docker-images/python3.7-alpine3.8.dockerfile) * [`python3.6-alpine3.8` _(Dockerfile)_](https://github.com/tiangolo/uvicorn-gunicorn-docker/blob/master/docker-images/python3.6-alpine3.8.dockerfile) @@ -13,7 +14,7 @@ # uvicorn-gunicorn -[**Docker**](https://www.docker.com/) image with [**Uvicorn**](https://www.uvicorn.org/) managed by [**Gunicorn**](https://gunicorn.org/) for high-performance web applications in **[Python](https://www.python.org/) 3.6 and above** with performance auto-tuning. Optionally with Alpine Linux. +[**Docker**](https://www.docker.com/) image with [**Uvicorn**](https://www.uvicorn.org/) managed by [**Gunicorn**](https://gunicorn.org/) for high-performance web applications in **[Python](https://www.python.org/) 3.6 and above** with performance auto-tuning. Optionally in a slim version or based on Alpine Linux. **GitHub repo**: [https://github.com/tiangolo/uvicorn-gunicorn-docker](https://github.com/tiangolo/uvicorn-gunicorn-docker) @@ -47,7 +48,7 @@ This image will set a sensible configuration based on the server it is running o It has sensible defaults, but you can configure it with environment variables or override the configuration files. -There is also an Alpine version. If you want it, use one of the Alpine tags from above. +There is also a slim version and another one based on Alpine Linux. If you want one of those, use one of the tags from above. ### Frameworks