Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for Python 3.10 #52

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ jobs:
matrix:
image:
- name: latest
python_version: "3.9"
python_version: "3.10"
- name: python3.10
python_version: "3.10"
- name: python3.9
python_version: "3.9"
- name: python3.8
Expand All @@ -20,6 +22,8 @@ jobs:
python_version: "3.7"
- name: python3.6
python_version: "3.6"
- name: python3.10-alpine3.15
python_version: "3.10"
- name: python3.9-alpine3.13
python_version: "3.9"
- name: python3.8-alpine3.11
Expand All @@ -29,15 +33,15 @@ jobs:
- name: python3.6-alpine3.8
python_version: "3.6"
fail-fast: true
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v2.3.1
with:
python-version: "3.7"
python-version: "3.10"
- name: Install Dependencies
run: python3.7 -m pip install docker pytest
run: python3.10 -m pip install docker pytest
- name: Deploy Image
run: bash scripts/build-push.sh
env:
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ jobs:
matrix:
image:
- name: latest
python_version: "3.9"
python_version: "3.10"
- name: python3.10
python_version: "3.10"
- name: python3.9
python_version: "3.9"
- name: python3.8
Expand All @@ -20,6 +22,8 @@ jobs:
python_version: "3.7"
- name: python3.6
python_version: "3.6"
- name: python3.10-alpine3.15
python_version: "3.10"
- name: python3.9-alpine3.13
python_version: "3.9"
- name: python3.8-alpine3.11
Expand All @@ -29,15 +33,15 @@ jobs:
- name: python3.6-alpine3.8
python_version: "3.6"
fail-fast: true
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v2.3.1
with:
python-version: "3.7"
python-version: "3.10"
- name: Install Dependencies
run: python3.7 -m pip install docker pytest
run: python3.10 -m pip install docker pytest
- name: Test Image
run: bash scripts/test.sh
env:
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

## Supported tags and respective `Dockerfile` links

* [`python3.9`, `latest` _(Dockerfile)_](https://github.com/tiangolo/meinheld-gunicorn-docker/blob/master/docker-images/python3.9.dockerfile)
* [`python3.10`, `latest` _(Dockerfile)_](https://github.com/tiangolo/meinheld-gunicorn-docker/blob/master/docker-images/python3.10.dockerfile)
* [`python3.9`, _(Dockerfile)_](https://github.com/tiangolo/meinheld-gunicorn-docker/blob/master/docker-images/python3.9.dockerfile)
* [`python3.8` _(Dockerfile)_](https://github.com/tiangolo/meinheld-gunicorn-docker/blob/master/docker-images/python3.8.dockerfile)
* [`python3.7`, _(Dockerfile)_](https://github.com/tiangolo/meinheld-gunicorn-docker/blob/master/docker-images/python3.7.dockerfile)
* [`python3.6` _(Dockerfile)_](https://github.com/tiangolo/meinheld-gunicorn-docker/blob/master/docker-images/python3.6.dockerfile)

## Discouraged tags

* [`python3.10-alpine3.15` _(Dockerfile)_](https://github.com/tiangolo/meinheld-gunicorn-docker/blob/master/docker-images/python3.10-alpine3.15.dockerfile)
* [`python3.9-alpine3.13` _(Dockerfile)_](https://github.com/tiangolo/meinheld-gunicorn-docker/blob/master/docker-images/python3.9-alpine3.13.dockerfile)
* [`python3.8-alpine3.11` _(Dockerfile)_](https://github.com/tiangolo/meinheld-gunicorn-docker/blob/master/docker-images/python3.8-alpine3.11.dockerfile)
* [`python3.7-alpine3.8` _(Dockerfile)_](https://github.com/tiangolo/meinheld-gunicorn-docker/blob/master/docker-images/python3.7-alpine3.8.dockerfile)
Expand Down Expand Up @@ -143,7 +145,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/meinheld-gunicorn:python3.9
FROM tiangolo/meinheld-gunicorn:python3.10

COPY ./requirements.txt /app/requirements.txt

Expand Down
30 changes: 30 additions & 0 deletions docker-images/python3.10-alpine3.15.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM python:3.10-alpine3.15

LABEL maintainer="Sebastian Ramirez <tiangolo@gmail.com>"

COPY requirements.txt /tmp/requirements.txt

RUN apk add --no-cache --virtual .build-deps gcc libc-dev \
&& pip install --no-cache-dir -r /tmp/requirements.txt \
&& apk del .build-deps gcc libc-dev

COPY ./entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

COPY ./start.sh /start.sh
RUN chmod +x /start.sh

COPY ./gunicorn_conf.py /gunicorn_conf.py

COPY ./app /app
WORKDIR /app/

ENV PYTHONPATH=/app

EXPOSE 80

ENTRYPOINT ["/entrypoint.sh"]

# Run the start script, it will check for an /app/prestart.sh script (e.g. for migrations)
# And then will start Gunicorn with Meinheld
CMD ["/start.sh"]
27 changes: 27 additions & 0 deletions docker-images/python3.10.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM python:3.10

LABEL maintainer="Sebastian Ramirez <tiangolo@gmail.com>"

COPY requirements.txt /tmp/requirements.txt
RUN pip install --no-cache-dir -r /tmp/requirements.txt

COPY ./entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

COPY ./start.sh /start.sh
RUN chmod +x /start.sh

COPY ./gunicorn_conf.py /gunicorn_conf.py

COPY ./app /app
WORKDIR /app/

ENV PYTHONPATH=/app

EXPOSE 80

ENTRYPOINT ["/entrypoint.sh"]

# Run the start script, it will check for an /app/prestart.sh script (e.g. for migrations)
# And then will start Gunicorn with Meinheld
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/meinheld-gunicorn:$NAME"
DOCKERFILE="$NAME"

if [ "$NAME" == "latest" ] ; then
DOCKERFILE="python3.9"
DOCKERFILE="python3.10"
fi

docker build -t "$use_tag" --file "./docker-images/${DOCKERFILE}.dockerfile" "./docker-images/"
4 changes: 3 additions & 1 deletion scripts/process_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
import sys

environments = [
{"NAME": "latest", "PYTHON_VERSION": "3.9"},
{"NAME": "latest", "PYTHON_VERSION": "3.10"},
{"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.6", "PYTHON_VERSION": "3.6"},
{"NAME": "python3.10-alpine3.15", "PYTHON_VERSION": "3.10"},
{"NAME": "python3.9-alpine3.13", "PYTHON_VERSION": "3.9"},
{"NAME": "python3.8-alpine3.11", "PYTHON_VERSION": "3.8"},
{"NAME": "python3.7-alpine3.8", "PYTHON_VERSION": "3.7"},
Expand Down