Skip to content

Commit

Permalink
✨ Add Python 3.9 and Alpine Python 3.9 (#52)
Browse files Browse the repository at this point in the history
Co-authored-by: Sebastián Ramírez <[email protected]>
  • Loading branch information
graue70 and tiangolo authored Sep 17, 2021
1 parent 8748ba1 commit e4e05ee
Show file tree
Hide file tree
Showing 8 changed files with 99 additions and 7 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,21 @@ 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
python_version: "3.7"
- name: python3.6
python_version: "3.6"
- 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"
- name: python3.8-alpine3.10
python_version: "3.8"
- name: python3.7-alpine3.8
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,21 @@ 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
python_version: "3.7"
- name: python3.6
python_version: "3.6"
- 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"
- name: python3.8-alpine3.10
python_version: "3.8"
- name: python3.7-alpine3.8
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@

## Supported tags and respective `Dockerfile` links

* [`python3.8`, `latest` _(Dockerfile)_](https://github.com/tiangolo/uvicorn-gunicorn-docker/blob/master/docker-images/python3.8.dockerfile)
* [`python3.9`, `latest` _(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.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)
* [`python3.9-alpine3.14` _(Dockerfile)_](https://github.com/tiangolo/uvicorn-gunicorn-docker/blob/master/docker-images/python3.9-alpine3.14.dockerfile)
* [`python3.8-alpine3.10` _(Dockerfile)_](https://github.com/tiangolo/uvicorn-gunicorn-docker/blob/master/docker-images/python3.8-alpine3.10.dockerfile)
* [`python3.7-alpine3.8` _(Dockerfile)_](https://github.com/tiangolo/uvicorn-gunicorn-docker/blob/master/docker-images/python3.7-alpine3.8.dockerfile)
* [`python3.6-alpine3.8` _(Dockerfile)_](https://github.com/tiangolo/uvicorn-gunicorn-docker/blob/master/docker-images/python3.6-alpine3.8.dockerfile)
Expand Down Expand Up @@ -72,7 +75,7 @@ If you are creating a new [**FastAPI**](https://fastapi.tiangolo.com/) web appli
* You don't need to clone the GitHub repo. You can use this image as a base image for other images, using this in your `Dockerfile`:

```Dockerfile
FROM tiangolo/uvicorn-gunicorn:python3.7
FROM tiangolo/uvicorn-gunicorn:python3.9

COPY ./app /app
```
Expand Down Expand Up @@ -116,7 +119,7 @@ Let's say you have a project managed with [Poetry](https://python-poetry.org/),
Then you could have a `Dockerfile` like:

```Dockerfile
FROM tiangolo/uvicorn-gunicorn:python3.7
FROM tiangolo/uvicorn-gunicorn:python3.9

# Install Poetry
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | POETRY_HOME=/opt/poetry python && \
Expand Down
26 changes: 26 additions & 0 deletions docker-images/python3.9-alpine3.14.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM python:3.9-alpine3.14

LABEL maintainer="Sebastian Ramirez <[email protected]>"

RUN apk add --no-cache --virtual .build-deps gcc libc-dev make \
&& pip install --no-cache-dir "uvicorn[standard]" gunicorn \
&& apk del .build-deps gcc libc-dev make

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"]
24 changes: 24 additions & 0 deletions docker-images/python3.9-slim.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM python:3.9-slim

LABEL maintainer="Sebastian Ramirez <[email protected]>"

RUN pip install --no-cache-dir "uvicorn[standard]" gunicorn

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"]
24 changes: 24 additions & 0 deletions docker-images/python3.9.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM python:3.9

LABEL maintainer="Sebastian Ramirez <[email protected]>"

RUN pip install --no-cache-dir "uvicorn[standard]" gunicorn

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"]
2 changes: 1 addition & 1 deletion scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use_tag="tiangolo/uvicorn-gunicorn:$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/"
5 changes: 4 additions & 1 deletion scripts/process_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
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"},
{"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"},
{"NAME": "python3.8-alpine3.10", "PYTHON_VERSION": "3.8"},
{"NAME": "python3.7-alpine3.8", "PYTHON_VERSION": "3.7"},
{"NAME": "python3.6-alpine3.8", "PYTHON_VERSION": "3.6"},
Expand Down

0 comments on commit e4e05ee

Please sign in to comment.