diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 3dbb994e..fad185d0 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -14,7 +14,9 @@ jobs: matrix: image: - name: latest - python_version: "3.10" + python_version: "3.11" + - name: python3.11 + python_version: "3.11" - name: python3.10 python_version: "3.10" - name: python3.9 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c74f70f8..713a2c7a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,7 +18,9 @@ jobs: matrix: image: - name: latest - python_version: "3.10" + python_version: "3.11" + - name: python3.11 + python_version: "3.11" - name: python3.10 python_version: "3.10" - name: python3.9 diff --git a/README.md b/README.md index aa9ff1c9..62aadc77 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,8 @@ ## Supported tags and respective `Dockerfile` links -* [`python3.10`, `latest` _(Dockerfile)_](https://github.com/tiangolo/uwsgi-nginx-flask-docker/blob/master/docker-images/python3.10.dockerfile) +* [`python3.11`, `latest` _(Dockerfile)_](https://github.com/tiangolo/uwsgi-nginx-flask-docker/blob/master/docker-images/python3.11.dockerfile) +* [`python3.10` _(Dockerfile)_](https://github.com/tiangolo/uwsgi-nginx-flask-docker/blob/master/docker-images/python3.10.dockerfile) * [`python3.9`, _(Dockerfile)_](https://github.com/tiangolo/uwsgi-nginx-flask-docker/blob/master/docker-images/python3.9.dockerfile) * [`python3.8`, _(Dockerfile)_](https://github.com/tiangolo/uwsgi-nginx-flask-docker/blob/master/docker-images/python3.8.dockerfile) * [`python3.7`, _(Dockerfile)_](https://github.com/tiangolo/uwsgi-nginx-flask-docker/blob/master/docker-images/python3.7.dockerfile) @@ -159,7 +160,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/uwsgi-nginx-flask:python3.10 +FROM tiangolo/uwsgi-nginx-flask:python3.11 COPY ./requirements.txt /app/requirements.txt @@ -186,7 +187,7 @@ Or you may follow the instructions to build your project from scratch: * Create a `Dockerfile` with: ```Dockerfile -FROM tiangolo/uwsgi-nginx-flask:python3.10 +FROM tiangolo/uwsgi-nginx-flask:python3.11 COPY ./app /app ``` @@ -499,7 +500,7 @@ Have in mind that `UWSGI_CHEAPER` must be lower than `UWSGI_PROCESSES`. So, if, for example, you need to start with 4 processes and grow to a maximum of 64, your `Dockerfile` could look like: ```Dockerfile -FROM tiangolo/uwsgi-nginx-flask:python3.10 +FROM tiangolo/uwsgi-nginx-flask:python3.11 ENV UWSGI_CHEAPER 4 ENV UWSGI_PROCESSES 64 @@ -526,7 +527,7 @@ To change this behavior, set the `LISTEN_PORT` environment variable. You might a You can do that in your `Dockerfile`, it would look something like: ```Dockerfile -FROM tiangolo/uwsgi-nginx-flask:python3.10 +FROM tiangolo/uwsgi-nginx-flask:python3.11 ENV LISTEN_PORT 8080 @@ -663,7 +664,7 @@ or you can set it to the keyword `auto` and it will try to auto-detect the numbe For example, using `auto`, your Dockerfile could look like: ```Dockerfile -FROM tiangolo/uwsgi-nginx-flask:python3.10 +FROM tiangolo/uwsgi-nginx-flask:python3.11 ENV NGINX_WORKER_PROCESSES auto diff --git a/docker-images/python3.11.dockerfile b/docker-images/python3.11.dockerfile new file mode 100644 index 00000000..3d9d5d91 --- /dev/null +++ b/docker-images/python3.11.dockerfile @@ -0,0 +1,37 @@ +FROM tiangolo/uwsgi-nginx:python3.11 + +LABEL maintainer="Sebastian Ramirez " + +# Install requirements +COPY requirements.txt /tmp/requirements.txt +RUN pip install --no-cache-dir -r /tmp/requirements.txt + +# URL under which static (not modified by Python) files will be requested +# They will be served by Nginx directly, without being handled by uWSGI +ENV STATIC_URL /static +# Absolute path in where the static files wil be +ENV STATIC_PATH /app/static + +# If STATIC_INDEX is 1, serve / with /static/index.html directly (or the static URL configured) +# ENV STATIC_INDEX 1 +ENV STATIC_INDEX 0 + +# Add demo app +COPY ./app /app +WORKDIR /app + +# Make /app/* available to be imported by Python globally to better support several use cases like Alembic migrations. +ENV PYTHONPATH=/app + +# Move the base entrypoint to reuse it +RUN mv /entrypoint.sh /uwsgi-nginx-entrypoint.sh +# Copy the entrypoint that will generate Nginx additional configs +COPY entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] + +# Run the start script provided by the parent image tiangolo/uwsgi-nginx. +# It will check for an /app/prestart.sh script (e.g. for migrations) +# And then will start Supervisor, which in turn will start Nginx and uWSGI +CMD ["/start.sh"] diff --git a/scripts/build.sh b/scripts/build.sh index edf2a2c8..a5822162 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -6,7 +6,7 @@ use_tag="tiangolo/uwsgi-nginx-flask:$NAME" DOCKERFILE="$NAME" if [ "$NAME" == "latest" ] ; then - DOCKERFILE="python3.10" + DOCKERFILE="python3.11" 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 50c60cf4..2ee75a91 100644 --- a/scripts/process_all.py +++ b/scripts/process_all.py @@ -3,7 +3,8 @@ import sys environments = [ - {"NAME": "latest", "PYTHON_VERSION": "3.10"}, + {"NAME": "latest", "PYTHON_VERSION": "3.11"}, + {"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"},