diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 5a5fcfc1..acf1d02e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -14,7 +14,9 @@ jobs: matrix: image: - name: latest - python_version: "3.11" + python_version: "3.12" + - name: python3.12 + python_version: "3.12" - name: python3.11 python_version: "3.11" - name: python3.10 @@ -25,6 +27,8 @@ jobs: python_version: "3.8" - name: python3.7 python_version: "3.7" + - name: python3.12-slim + python_version: "3.12" - name: python3.11-slim python_version: "3.11" - name: python3.10-slim diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 83a14efe..ab6c5f06 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,7 +18,9 @@ jobs: matrix: image: - name: latest - python_version: "3.11" + python_version: "3.12" + - name: python3.12 + python_version: "3.12" - name: python3.11 python_version: "3.11" - name: python3.10 @@ -29,6 +31,8 @@ jobs: python_version: "3.8" - name: python3.7 python_version: "3.7" + - name: python3.12-slim + python_version: "3.12" - name: python3.11-slim python_version: "3.11" - name: python3.10-slim diff --git a/README.md b/README.md index 856ba358..611bf999 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,13 @@ ## Supported tags and respective `Dockerfile` links -* [`python3.11`, `latest` _(Dockerfile)_](https://github.com/tiangolo/uvicorn-gunicorn-docker/blob/master/docker-images/python3.11.dockerfile) +* [`python3.12`, `latest` _(Dockerfile)_](https://github.com/tiangolo/uvicorn-gunicorn-docker/blob/master/docker-images/python3.12.dockerfile) +* [`python3.11`, _(Dockerfile)_](https://github.com/tiangolo/uvicorn-gunicorn-docker/blob/master/docker-images/python3.11.dockerfile) * [`python3.10`, _(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.12-slim` _(Dockerfile)_](https://github.com/tiangolo/uvicorn-gunicorn-docker/blob/master/docker-images/python3.12-slim.dockerfile) * [`python3.11-slim` _(Dockerfile)_](https://github.com/tiangolo/uvicorn-gunicorn-docker/blob/master/docker-images/python3.11-slim.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) @@ -154,7 +156,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.11 +FROM tiangolo/uvicorn-gunicorn:python3.12 COPY ./requirements.txt /app/requirements.txt @@ -212,7 +214,7 @@ COPY ./pyproject.toml ./poetry.lock* /tmp/ RUN poetry export -f requirements.txt --output requirements.txt --without-hashes -FROM tiangolo/uvicorn-gunicorn:python3.11 +FROM tiangolo/uvicorn-gunicorn:python3.12 COPY --from=requirements-stage /tmp/requirements.txt /app/requirements.txt diff --git a/docker-images/python3.12-slim.dockerfile b/docker-images/python3.12-slim.dockerfile new file mode 100644 index 00000000..f0dd1d24 --- /dev/null +++ b/docker-images/python3.12-slim.dockerfile @@ -0,0 +1,25 @@ +FROM python:3.12-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.12.dockerfile b/docker-images/python3.12.dockerfile new file mode 100644 index 00000000..01170e61 --- /dev/null +++ b/docker-images/python3.12.dockerfile @@ -0,0 +1,25 @@ +FROM python:3.12 + +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 2d5bbe4e..f8c6bb23 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.11" + DOCKERFILE="python3.12" 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 c269d167..427515dc 100644 --- a/scripts/process_all.py +++ b/scripts/process_all.py @@ -3,12 +3,14 @@ import sys environments = [ - {"NAME": "latest", "PYTHON_VERSION": "3.11"}, + {"NAME": "latest", "PYTHON_VERSION": "3.12"}, + {"NAME": "python3.12", "PYTHON_VERSION": "3.12"}, {"NAME": "python3.11", "PYTHON_VERSION": "3.11"}, {"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.12-slim", "PYTHON_VERSION": "3.12"}, {"NAME": "python3.11-slim", "PYTHON_VERSION": "3.11"}, {"NAME": "python3.10-slim", "PYTHON_VERSION": "3.10"}, {"NAME": "python3.9-slim", "PYTHON_VERSION": "3.9"},