Skip to content

Commit

Permalink
Updated Python version. Unified pipeline. Updated documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
max-pfeiffer committed May 3, 2022
1 parent 2cdfc00 commit 5648bf8
Show file tree
Hide file tree
Showing 9 changed files with 148 additions and 193 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Pipeline

on: push

jobs:
run-tests:
runs-on: ubuntu-20.04
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install Poetry
uses: abatilo/[email protected]
with:
poetry-version: 1.1.11
- name: Install dependencies
run: |
poetry config virtualenvs.in-project true
poetry install --no-root
- name: Run all tests with pytest
run: |
source .venv/bin/activate
export DOCKER_BUILDKIT=1
pytest
pytest --cov=./ --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}

publish-all-images:
needs: run-tests
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-20.04
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Get Git Commit Tag Name
uses: olegtarasov/[email protected]
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install Poetry
uses: abatilo/[email protected]
with:
poetry-version: 1.1.11
- name: Install dependencies
run: |
poetry config virtualenvs.in-project true
poetry install --no-root
- name: Publish Image to Docker Hub
env:
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }}
run: |
source .venv/bin/activate
python publish.py
34 changes: 0 additions & 34 deletions .github/workflows/publish-images.yml

This file was deleted.

36 changes: 0 additions & 36 deletions .github/workflows/test.yml

This file was deleted.

13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
[![codecov](https://codecov.io/gh/max-pfeiffer/uvicorn-gunicorn-poetry/branch/main/graph/badge.svg?token=ZRUKVNP3I5)](https://codecov.io/gh/max-pfeiffer/uvicorn-gunicorn-poetry)
![pipeline workflow](https://github.com/max-pfeiffer/uvicorn-gunicorn-poetry/actions/workflows/pipeline.yml/badge.svg)
![Docker Image Size (latest semver)](https://img.shields.io/docker/image-size/pfeiffermax/uvicorn-gunicorn-poetry?sort=semver)
![Docker Pulls](https://img.shields.io/docker/pulls/pfeiffermax/uvicorn-gunicorn-poetry)
# uvicorn-gunicorn-poetry
This Docker image provides a platform to run Python applications with [Gunicorn](https://gunicorn.org) as process manager and
[Uvicorn](https://www.uvicorn.org/) workers.
Expand All @@ -9,14 +12,14 @@ on micro frameworks like [FastAPI](https://fastapi.tiangolo.com/).
Therefore source and documentation contain a lot of references to documentation of dependencies used in this project, so users
of this image can follow up on that.

Any feedback is highly appreciated and will be considered.
If you would like to run your Python application with Uvicorn on [Kubernetes](https://kubernetes.io/), please check out my other project which does not use
Gunicorn as process manager: https://github.com/max-pfeiffer/uvicorn-poetry

Docker Hub: [pfeiffermax/uvicorn-gunicorn-poetry](https://hub.docker.com/r/pfeiffermax/uvicorn-gunicorn-poetry)
Any feedback is highly appreciated and will be considered.

GitHub Repository: [https://github.com/max-pfeiffer/uvicorn-gunicorn-poetry](https://github.com/max-pfeiffer/uvicorn-gunicorn-poetry)
**Docker Hub:** [pfeiffermax/uvicorn-gunicorn-poetry](https://hub.docker.com/r/pfeiffermax/uvicorn-gunicorn-poetry)

If you would like to run your Python application with Uvicorn on [Kubernetes](https://kubernetes.io/), please check out my other project which does not use
Gunicorn as process manager: https://github.com/max-pfeiffer/uvicorn-poetry
**GitHub Repository:** [https://github.com/max-pfeiffer/uvicorn-gunicorn-poetry](https://github.com/max-pfeiffer/uvicorn-gunicorn-poetry)

**IMPORTANT:** Please be aware of a bug with Gunicorn: [worker reload with Uvicorn workers is currently broken.](https://github.com/benoitc/gunicorn/issues/2339)
So the latest version of that image does not provide that functionality any more.
Expand Down
12 changes: 5 additions & 7 deletions build/constants.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
from typing import List

UVICORN_GUNICORN_POETRY_IMAGE_NAME = "pfeiffermax/uvicorn-gunicorn-poetry"
FAST_API_MULTISTAGE_IMAGE_NAME = "fast-api-multistage-build"
TARGET_ARCHITECTURES: List[str] = [
"python3.9.8-bullseye",
"python3.9.8-slim-bullseye",
TARGET_ARCHITECTURES: list[str] = [
"python3.9.12-bullseye",
"python3.9.12-slim-bullseye",
]
BASE_IMAGES = {
TARGET_ARCHITECTURES[0]: "python:3.9.8-bullseye",
TARGET_ARCHITECTURES[1]: "python:3.9.8-slim-bullseye",
TARGET_ARCHITECTURES[0]: "python:3.9.12-bullseye",
TARGET_ARCHITECTURES[1]: "python:3.9.12-slim-bullseye",
}
Loading

0 comments on commit 5648bf8

Please sign in to comment.