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

Add support for python3.8.16-slim #214

Closed
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
48 changes: 25 additions & 23 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,28 @@ jobs:
strategy:
matrix:
image:
- 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"
- name: python3.7
python_version: "3.7"
- name: python3.11-slim
python_version: "3.11"
- name: python3.10-slim
python_version: "3.10"
- name: python3.9-slim
python_version: "3.9"
- name: python3.8-slim
python_version: "3.8"
# - 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"
# - name: python3.7
# python_version: "3.7"
# - name: python3.11-slim
# python_version: "3.11"
# - name: python3.10-slim
# python_version: "3.10"
# - name: python3.9-slim
# python_version: "3.9"
# - name: python3.8-slim
# python_version: "3.8"
- name: python3.8.16-slim
python_version: "3.8.16"
fail-fast: true
runs-on: ubuntu-latest
steps:
Expand All @@ -58,13 +60,13 @@ jobs:
push: true
platforms: linux/amd64,linux/arm64
tags: |
tiangolo/uvicorn-gunicorn:${{ matrix.image.name }}
tiangolo/uvicorn-gunicorn:${{ matrix.image.name }}-${{ env.DATE_TAG }}
shiphero/uvicorn-gunicorn:${{ matrix.image.name }}
shiphero/uvicorn-gunicorn:${{ matrix.image.name }}-${{ env.DATE_TAG }}
context: ./docker-images/
file: ./docker-images/${{ env.DOCKERFILE_NAME }}.dockerfile
- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: tiangolo/uvicorn-gunicorn
repository: shiphero/uvicorn-gunicorn
44 changes: 23 additions & 21 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,28 @@ jobs:
strategy:
matrix:
image:
- 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"
- name: python3.7
python_version: "3.7"
- name: python3.11-slim
python_version: "3.11"
- name: python3.10-slim
python_version: "3.10"
- name: python3.9-slim
python_version: "3.9"
- name: python3.8-slim
python_version: "3.8"
# - 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"
# - name: python3.7
# python_version: "3.7"
# - name: python3.11-slim
# python_version: "3.11"
# - name: python3.10-slim
# python_version: "3.10"
# - name: python3.9-slim
# python_version: "3.9"
# - name: python3.8-slim
# python_version: "3.8"
- name: python3.8.16-slim
python_version: "3.8.16"
fail-fast: true
runs-on: ubuntu-latest
steps:
Expand All @@ -51,7 +53,7 @@ jobs:
uses: docker/build-push-action@v5
with:
push: false
tags: tiangolo/uvicorn-gunicorn:${{ matrix.image.name }}
tags: shiphero/uvicorn-gunicorn:${{ matrix.image.name }}
context: ./docker-images/
file: ./docker-images/${{ env.DOCKERFILE_NAME }}.dockerfile
- name: Set up Python
Expand Down
2 changes: 1 addition & 1 deletion docker-images/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ async def __call__(self, receive, send):
"headers": [[b"content-type", b"text/plain"]],
}
)
version = f"{sys.version_info.major}.{sys.version_info.minor}"
version = f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}"
message = f"Hello world! From Uvicorn with Gunicorn. Using Python {version}".encode(
"utf-8"
)
Expand Down
28 changes: 28 additions & 0 deletions docker-images/python3.8.16-slim.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM python:3.8.16-slim

ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1

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

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

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"]
1 change: 1 addition & 0 deletions scripts/process_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
{"NAME": "python3.10-slim", "PYTHON_VERSION": "3.10"},
{"NAME": "python3.9-slim", "PYTHON_VERSION": "3.9"},
{"NAME": "python3.8-slim", "PYTHON_VERSION": "3.8"},
{"NAME": "python3.8.16-slim", "PYTHON_VERSION": "3.8.16"},
]

start_with = os.environ.get("START_WITH")
Expand Down
2 changes: 1 addition & 1 deletion tests/test_01_main/test_defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def verify_container(container: Container, response_text: str) -> None:

def test_defaults() -> None:
name = os.getenv("NAME")
image = f"tiangolo/uvicorn-gunicorn:{name}"
image = f"shiphero/uvicorn-gunicorn:{name}"
response_text = get_response_text1()
sleep_time = int(os.getenv("SLEEP_TIME", 1))
remove_previous_container(client)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_01_main/test_env_vars_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def verify_container(container: DockerClient, response_text: str) -> None:

def test_env_vars_1() -> None:
name = os.getenv("NAME")
image = f"tiangolo/uvicorn-gunicorn:{name}"
image = f"shiphero/uvicorn-gunicorn:{name}"
response_text = get_response_text1()
sleep_time = int(os.getenv("SLEEP_TIME", 1))
remove_previous_container(client)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_01_main/test_env_vars_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def verify_container(container: Container) -> None:

def test_env_vars_2() -> None:
name = os.getenv("NAME")
image = f"tiangolo/uvicorn-gunicorn:{name}"
image = f"shiphero/uvicorn-gunicorn:{name}"
sleep_time = int(os.getenv("SLEEP_TIME", 1))
remove_previous_container(client)
container = client.containers.run(
Expand Down
2 changes: 1 addition & 1 deletion tests/test_01_main/test_env_vars_3.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def verify_container(container: DockerClient, response_text: str) -> None:

def test_env_bind() -> None:
name = os.getenv("NAME")
image = f"tiangolo/uvicorn-gunicorn:{name}"
image = f"shiphero/uvicorn-gunicorn:{name}"
response_text = get_response_text1()
sleep_time = int(os.getenv("SLEEP_TIME", 1))
remove_previous_container(client)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_03_reload/test_defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def verify_container(container: DockerClient, response_text: str) -> None:

def test_defaults() -> None:
name = os.getenv("NAME")
image = f"tiangolo/uvicorn-gunicorn:{name}"
image = f"shiphero/uvicorn-gunicorn:{name}"
response_text = get_response_text1()
sleep_time = int(os.getenv("SLEEP_TIME", 1))
remove_previous_container(client)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_03_reload/test_env_vars_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def verify_container(container: DockerClient, response_text: str) -> None:

def test_env_vars_1() -> None:
name = os.getenv("NAME")
image = f"tiangolo/uvicorn-gunicorn:{name}"
image = f"shiphero/uvicorn-gunicorn:{name}"
response_text = get_response_text1()
sleep_time = int(os.getenv("SLEEP_TIME", 1))
remove_previous_container(client)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_03_reload/test_env_vars_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def verify_container(container: Container) -> None:

def test_env_vars_2() -> None:
name = os.getenv("NAME")
image = f"tiangolo/uvicorn-gunicorn:{name}"
image = f"shiphero/uvicorn-gunicorn:{name}"
sleep_time = int(os.getenv("SLEEP_TIME", 1))
time.sleep(sleep_time)
remove_previous_container(client)
Expand Down
2 changes: 1 addition & 1 deletion tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ def get_response_text2() -> str:


def generate_dockerfile_content(name: str) -> str:
content = f"FROM tiangolo/uvicorn-gunicorn:{name}\n"
content = f"FROM shiphero/uvicorn-gunicorn:{name}\n"
content += "COPY ./app /app"
return content
Loading