From 88d86794c2e4c62cd3ffc44aa67f526ce49ef929 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Tue, 26 Oct 2021 19:49:37 +0200 Subject: [PATCH 1/3] =?UTF-8?q?=E2=9C=A8=20Add=20support=20for=20Python=20?= =?UTF-8?q?3.10?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 8 ++++++-- .github/workflows/test.yml | 6 +++++- README.md | 8 +++++--- docker-images/python3.10-slim.dockerfile | 25 ++++++++++++++++++++++++ docker-images/python3.10.dockerfile | 25 ++++++++++++++++++++++++ scripts/build.sh | 2 +- scripts/process_all.py | 4 +++- 7 files changed, 70 insertions(+), 8 deletions(-) create mode 100644 docker-images/python3.10-slim.dockerfile create mode 100644 docker-images/python3.10.dockerfile diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index c7f10216..d8771030 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -11,7 +11,9 @@ jobs: matrix: image: - name: latest - python_version: "3.9" + python_version: "3.10" + - name: python3.10 + python_version: "3.10" - name: python3.9 python_version: "3.9" - name: python3.8 @@ -20,7 +22,9 @@ jobs: python_version: "3.7" - name: python3.6 python_version: "3.6" - - name: python3.9-slim + - name: python3.10-slim + python_version: "3.9" + - name: python3.10-slim python_version: "3.9" - name: python3.8-slim python_version: "3.8" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6fbc70e3..d7eb6a1b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,9 @@ jobs: matrix: image: - name: latest - python_version: "3.9" + python_version: "3.10" + - name: python3.10 + python_version: "3.10" - name: python3.9 python_version: "3.9" - name: python3.8 @@ -20,6 +22,8 @@ jobs: python_version: "3.7" - name: python3.6 python_version: "3.6" + - name: python3.10-slim + python_version: "3.10" - name: python3.9-slim python_version: "3.9" - name: python3.8-slim diff --git a/README.md b/README.md index e86c464e..527557a7 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,12 @@ ## Supported tags and respective `Dockerfile` links -* [`python3.9`, `latest` _(Dockerfile)_](https://github.com/tiangolo/uvicorn-gunicorn-docker/blob/master/docker-images/python3.9.dockerfile) +* [`python3.10`, `latest` _(Dockerfile)_](https://github.com/tiangolo/uvicorn-gunicorn-docker/blob/master/docker-images/python3.10.dockerfile) +* [`python3.9`, _(Dockerfile)_](https://github.com/tiangolo/uvicorn-gunicorn-docker/blob/master/docker-images/python3.9.dockerfile) * [`python3.8`, _(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.10-slim` _(Dockerfile)_](https://github.com/tiangolo/uvicorn-gunicorn-docker/blob/master/docker-images/python3.10-slim.dockerfile) * [`python3.9-slim` _(Dockerfile)_](https://github.com/tiangolo/uvicorn-gunicorn-docker/blob/master/docker-images/python3.9-slim.dockerfile) * [`python3.8-slim` _(Dockerfile)_](https://github.com/tiangolo/uvicorn-gunicorn-docker/blob/master/docker-images/python3.8-slim.dockerfile) @@ -142,7 +144,7 @@ You can use this image as a base image for other images. Assuming you have a file `requirements.txt`, you could have a `Dockerfile` like this: ```Dockerfile -FROM tiangolo/uvicorn-gunicorn:python3.9 +FROM tiangolo/uvicorn-gunicorn:python3.10 COPY ./requirements.txt /app/requirements.txt @@ -200,7 +202,7 @@ COPY ./pyproject.toml ./poetry.lock* /tmp/ RUN poetry export -f requirements.txt --output requirements.txt --without-hashes -FROM tiangolo/uvicorn-gunicorn:python3.9 +FROM tiangolo/uvicorn-gunicorn:python3.10 COPY --from=requirements-stage /tmp/requirements.txt /app/requirements.txt diff --git a/docker-images/python3.10-slim.dockerfile b/docker-images/python3.10-slim.dockerfile new file mode 100644 index 00000000..315c93fb --- /dev/null +++ b/docker-images/python3.10-slim.dockerfile @@ -0,0 +1,25 @@ +FROM python:3.10-slim + +LABEL maintainer="Sebastian Ramirez " + +COPY requirements.txt /tmp/requirements.txt +RUN pip install --no-cache-dir -r /tmp/requirements.txt + +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"] diff --git a/docker-images/python3.10.dockerfile b/docker-images/python3.10.dockerfile new file mode 100644 index 00000000..25b7c329 --- /dev/null +++ b/docker-images/python3.10.dockerfile @@ -0,0 +1,25 @@ +FROM python:3.10 + +LABEL maintainer="Sebastian Ramirez " + +COPY requirements.txt /tmp/requirements.txt +RUN pip install --no-cache-dir -r /tmp/requirements.txt + +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"] diff --git a/scripts/build.sh b/scripts/build.sh index 6987d400..6748d051 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -6,7 +6,7 @@ use_tag="tiangolo/uvicorn-gunicorn:$NAME" DOCKERFILE="$NAME" if [ "$NAME" == "latest" ] ; then - DOCKERFILE="python3.9" + DOCKERFILE="python3.10" fi docker build -t "$use_tag" --file "./docker-images/${DOCKERFILE}.dockerfile" "./docker-images/" diff --git a/scripts/process_all.py b/scripts/process_all.py index 2ec7cc01..6edec19c 100644 --- a/scripts/process_all.py +++ b/scripts/process_all.py @@ -3,11 +3,13 @@ import sys environments = [ - {"NAME": "latest", "PYTHON_VERSION": "3.9"}, + {"NAME": "latest", "PYTHON_VERSION": "3.10"}, + {"NAME": "python3.10", "PYTHON_VERSION": "3.10"}, {"NAME": "python3.9", "PYTHON_VERSION": "3.9"}, {"NAME": "python3.8", "PYTHON_VERSION": "3.8"}, {"NAME": "python3.7", "PYTHON_VERSION": "3.7"}, {"NAME": "python3.6", "PYTHON_VERSION": "3.6"}, + {"NAME": "python3.10-slim", "PYTHON_VERSION": "3.10"}, {"NAME": "python3.9-slim", "PYTHON_VERSION": "3.9"}, {"NAME": "python3.8-slim", "PYTHON_VERSION": "3.8"}, {"NAME": "python3.9-alpine3.14", "PYTHON_VERSION": "3.9"}, From 1fe260a7586ab1a5d09c90da8a33a7a53cf3441f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Fri, 25 Nov 2022 12:15:33 +0100 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=90=9B=20Update=20.github/workflows/d?= =?UTF-8?q?eploy.yml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Chris Griffith --- .github/workflows/deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 54fd1094..675249cb 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -23,8 +23,8 @@ jobs: - name: python3.6 python_version: "3.6" - name: python3.10-slim - python_version: "3.9" - - name: python3.10-slim + python_version: "3.10" + - name: python3.9-slim python_version: "3.9" - name: python3.8-slim python_version: "3.8" From f6bc414cb143879862dd7893a2e441b34f61033c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Fri, 25 Nov 2022 12:47:06 +0100 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=91=B7=20Trigger=20CI,=20python=203.9?= =?UTF-8?q?=20didn't=20run?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit