diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 9031325a..01ffacda 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -11,7 +11,9 @@ jobs: matrix: image: - name: latest - python_version: "3.8" + python_version: "3.9" + - name: python3.9 + python_version: "3.9" - name: python3.8 python_version: "3.8" - name: python3.7 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5618b341..4e1eef53 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,9 @@ jobs: matrix: image: - name: latest - python_version: "3.8" + python_version: "3.9" + - name: python3.9 + python_version: "3.9" - name: python3.8 python_version: "3.8" - name: python3.7 @@ -30,8 +32,14 @@ jobs: uses: actions/setup-python@v1 with: python-version: "3.7" + - name: Install poetry + run: | + python -m pip install --upgrade pip + python -m pip install poetry + - name: Configure poetry + run: python -m poetry config virtualenvs.create false - name: Install Dependencies - run: python3.7 -m pip install docker pytest + run: python -m poetry install - name: Test Image run: bash scripts/test.sh env: diff --git a/README.md b/README.md index 6f944bb3..6fac7d42 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,8 @@ ## Supported tags and respective `Dockerfile` links -* [`python3.8`, `latest` _(Dockerfile)_](https://github.com/tiangolo/uwsgi-nginx-flask-docker/blob/master/docker-images/python3.8.dockerfile) +* [`python3.9`, `latest` _(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.8-alpine` _(Dockerfile)_](https://github.com/tiangolo/uwsgi-nginx-flask-docker/blob/master/docker-images/python3.8-alpine.dockerfile) * [`python3.7`, _(Dockerfile)_](https://github.com/tiangolo/uwsgi-nginx-flask-docker/blob/master/docker-images/python3.7.dockerfile) * [`python3.6` _(Dockerfile)_](https://github.com/tiangolo/uwsgi-nginx-flask-docker/blob/master/docker-images/python3.6.dockerfile) @@ -68,7 +69,7 @@ It is very similar to **tiangolo/uwsgi-nginx-flask**, so you can still use many You don't have to clone this repo, you should be able to use this image as a base image for your project with something in your `Dockerfile` like: ```Dockerfile -FROM tiangolo/uwsgi-nginx-flask:python3.8 +FROM tiangolo/uwsgi-nginx-flask:python3.9 COPY ./app /app ``` @@ -93,7 +94,7 @@ Or you may follow the instructions to build your project from scratch: * Create a `Dockerfile` with: ```Dockerfile -FROM tiangolo/uwsgi-nginx-flask:python3.8 +FROM tiangolo/uwsgi-nginx-flask:python3.9 COPY ./app /app ``` @@ -406,7 +407,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.8 +FROM tiangolo/uwsgi-nginx-flask:python3.9 ENV UWSGI_CHEAPER 4 ENV UWSGI_PROCESSES 64 @@ -433,7 +434,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.8 +FROM tiangolo/uwsgi-nginx-flask:python3.9 ENV LISTEN_PORT 8080 @@ -570,7 +571,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.8 +FROM tiangolo/uwsgi-nginx-flask:python3.9 ENV NGINX_WORKER_PROCESSES auto diff --git a/docker-images/python3.9.dockerfile b/docker-images/python3.9.dockerfile new file mode 100644 index 00000000..601049d4 --- /dev/null +++ b/docker-images/python3.9.dockerfile @@ -0,0 +1,35 @@ +FROM tiangolo/uwsgi-nginx:python3.9 + +LABEL maintainer="Sebastian Ramirez " + +RUN pip install flask + +# 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 57cd7b51..593e2089 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.8" + DOCKERFILE="python3.9" 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 4f1895b8..91f452d0 100644 --- a/scripts/process_all.py +++ b/scripts/process_all.py @@ -3,7 +3,8 @@ import sys environments = [ - {"NAME": "latest", "PYTHON_VERSION": "3.8"}, + {"NAME": "latest", "PYTHON_VERSION": "3.9"}, + {"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"},