Skip to content

Commit 64a772c

Browse files
authored
✨ Add Python 3.9 image (#232)
1 parent d981196 commit 64a772c

File tree

6 files changed

+58
-11
lines changed

6 files changed

+58
-11
lines changed

.github/workflows/deploy.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ jobs:
1111
matrix:
1212
image:
1313
- name: latest
14-
python_version: "3.8"
14+
python_version: "3.9"
15+
- name: python3.9
16+
python_version: "3.9"
1517
- name: python3.8
1618
python_version: "3.8"
1719
- name: python3.7

.github/workflows/test.yml

+10-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ jobs:
1111
matrix:
1212
image:
1313
- name: latest
14-
python_version: "3.8"
14+
python_version: "3.9"
15+
- name: python3.9
16+
python_version: "3.9"
1517
- name: python3.8
1618
python_version: "3.8"
1719
- name: python3.7
@@ -30,8 +32,14 @@ jobs:
3032
uses: actions/setup-python@v1
3133
with:
3234
python-version: "3.7"
35+
- name: Install poetry
36+
run: |
37+
python -m pip install --upgrade pip
38+
python -m pip install poetry
39+
- name: Configure poetry
40+
run: python -m poetry config virtualenvs.create false
3341
- name: Install Dependencies
34-
run: python3.7 -m pip install docker pytest
42+
run: python -m poetry install
3543
- name: Test Image
3644
run: bash scripts/test.sh
3745
env:

README.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
## Supported tags and respective `Dockerfile` links
44

5-
* [`python3.8`, `latest` _(Dockerfile)_](https://github.com/tiangolo/uwsgi-nginx-flask-docker/blob/master/docker-images/python3.8.dockerfile)
5+
* [`python3.9`, `latest` _(Dockerfile)_](https://github.com/tiangolo/uwsgi-nginx-flask-docker/blob/master/docker-images/python3.9.dockerfile)
6+
* [`python3.8`, _(Dockerfile)_](https://github.com/tiangolo/uwsgi-nginx-flask-docker/blob/master/docker-images/python3.8.dockerfile)
67
* [`python3.8-alpine` _(Dockerfile)_](https://github.com/tiangolo/uwsgi-nginx-flask-docker/blob/master/docker-images/python3.8-alpine.dockerfile)
78
* [`python3.7`, _(Dockerfile)_](https://github.com/tiangolo/uwsgi-nginx-flask-docker/blob/master/docker-images/python3.7.dockerfile)
89
* [`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
6869
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:
6970

7071
```Dockerfile
71-
FROM tiangolo/uwsgi-nginx-flask:python3.8
72+
FROM tiangolo/uwsgi-nginx-flask:python3.9
7273

7374
COPY ./app /app
7475
```
@@ -93,7 +94,7 @@ Or you may follow the instructions to build your project from scratch:
9394
* Create a `Dockerfile` with:
9495

9596
```Dockerfile
96-
FROM tiangolo/uwsgi-nginx-flask:python3.8
97+
FROM tiangolo/uwsgi-nginx-flask:python3.9
9798

9899
COPY ./app /app
99100
```
@@ -406,7 +407,7 @@ Have in mind that `UWSGI_CHEAPER` must be lower than `UWSGI_PROCESSES`.
406407
So, if, for example, you need to start with 4 processes and grow to a maximum of 64, your `Dockerfile` could look like:
407408

408409
```Dockerfile
409-
FROM tiangolo/uwsgi-nginx-flask:python3.8
410+
FROM tiangolo/uwsgi-nginx-flask:python3.9
410411

411412
ENV UWSGI_CHEAPER 4
412413
ENV UWSGI_PROCESSES 64
@@ -433,7 +434,7 @@ To change this behavior, set the `LISTEN_PORT` environment variable. You might a
433434
You can do that in your `Dockerfile`, it would look something like:
434435

435436
```Dockerfile
436-
FROM tiangolo/uwsgi-nginx-flask:python3.8
437+
FROM tiangolo/uwsgi-nginx-flask:python3.9
437438

438439
ENV LISTEN_PORT 8080
439440

@@ -570,7 +571,7 @@ or you can set it to the keyword `auto` and it will try to auto-detect the numbe
570571
For example, using `auto`, your Dockerfile could look like:
571572

572573
```Dockerfile
573-
FROM tiangolo/uwsgi-nginx-flask:python3.8
574+
FROM tiangolo/uwsgi-nginx-flask:python3.9
574575

575576
ENV NGINX_WORKER_PROCESSES auto
576577

docker-images/python3.9.dockerfile

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
FROM tiangolo/uwsgi-nginx:python3.9
2+
3+
LABEL maintainer="Sebastian Ramirez <tiangolo@gmail.com>"
4+
5+
RUN pip install flask
6+
7+
# URL under which static (not modified by Python) files will be requested
8+
# They will be served by Nginx directly, without being handled by uWSGI
9+
ENV STATIC_URL /static
10+
# Absolute path in where the static files wil be
11+
ENV STATIC_PATH /app/static
12+
13+
# If STATIC_INDEX is 1, serve / with /static/index.html directly (or the static URL configured)
14+
# ENV STATIC_INDEX 1
15+
ENV STATIC_INDEX 0
16+
17+
# Add demo app
18+
COPY ./app /app
19+
WORKDIR /app
20+
21+
# Make /app/* available to be imported by Python globally to better support several use cases like Alembic migrations.
22+
ENV PYTHONPATH=/app
23+
24+
# Move the base entrypoint to reuse it
25+
RUN mv /entrypoint.sh /uwsgi-nginx-entrypoint.sh
26+
# Copy the entrypoint that will generate Nginx additional configs
27+
COPY entrypoint.sh /entrypoint.sh
28+
RUN chmod +x /entrypoint.sh
29+
30+
ENTRYPOINT ["/entrypoint.sh"]
31+
32+
# Run the start script provided by the parent image tiangolo/uwsgi-nginx.
33+
# It will check for an /app/prestart.sh script (e.g. for migrations)
34+
# And then will start Supervisor, which in turn will start Nginx and uWSGI
35+
CMD ["/start.sh"]

scripts/build.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use_tag="tiangolo/uwsgi-nginx-flask:$NAME"
66
DOCKERFILE="$NAME"
77

88
if [ "$NAME" == "latest" ] ; then
9-
DOCKERFILE="python3.8"
9+
DOCKERFILE="python3.9"
1010
fi
1111

1212
docker build -t "$use_tag" --file "./docker-images/${DOCKERFILE}.dockerfile" "./docker-images/"

scripts/process_all.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
import sys
44

55
environments = [
6-
{"NAME": "latest", "PYTHON_VERSION": "3.8"},
6+
{"NAME": "latest", "PYTHON_VERSION": "3.9"},
7+
{"NAME": "python3.9", "PYTHON_VERSION": "3.9"},
78
{"NAME": "python3.8", "PYTHON_VERSION": "3.8"},
89
{"NAME": "python3.7", "PYTHON_VERSION": "3.7"},
910
{"NAME": "python3.6", "PYTHON_VERSION": "3.6"},

0 commit comments

Comments
 (0)