GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - ismael-su/python-ci: Python FastApi docker CI/CD Workflow This project is a showcase of how we can implement a CI/CD workflow on a fastApi based project ran in a Docker container The base FastAPI Image

BranchesTags
Open more actions menu

Latest commit

 

History

21 Commits
21 Commits

Folders and files

NameName
Last commit message
Last commit date
.githooks/hooks
.githooks/hooks
 
 
.github/workflows
.github/workflows
 
 
app
app
 
 
tests
tests
 
 
.dockerignore
.dockerignore
 
 
.gitignore
.gitignore
 
 
.pre-commit-config.yaml
.pre-commit-config.yaml
 
 
Dockerfile
Dockerfile
 
 
README.md
README.md
 
 
__init__.py
__init__.py
 
 
tox.ini
tox.ini
 
 

Repository files navigation

Python FastApi docker CI/CD Workflow

This project is a showcase of how we can implement a CI/CD workflow on a fastApi based project ran in a Docker container from the base FastAPI Image

Run the docker image

Clone the project

git clone https://github.com/ismael-su/python-ci
cd python-ci
python3 -m venv venv
pip install -r requirements.txt

Build locally and run

docker build -t myimage .
docker run -d --name rs -p 0.0.0.0:8080:2376/tcp myimage

Pull image from github package and run locally

Note that the login is required for this step

docker login -u {github_username} -p {[token](https://github.com/settings/tokens)} ghcr.io
docker pull ghcr.io/ismael-su/python-ci:latest
docker run -d --name rs -p 0.0.0.0:8080:2376/tcp ghcr.io/ismael-su/python-ci:latest

CI / CD Workflows and Linting/Testing

Before each commit i run some githooks you will find under .github directory

pre-commit

pip freeze > requirements.txt
git add requirements.txt
autopep8 --in-place --aggressive --aggressive ./app/*.py
flake8 . --count  --show-source --s
pytest

This script invokes autopep8 that automatically formats Python code to conform to the PEP 8 style guide Flake8 which is a great toolkit for checking your code base against coding style (PEP8), programming errors (like “library imported but unused” and “Undefined name”). Pytest is a python framework for running unit test. the test file for this project is under app/test_index file

github actions

Under .github/workflows/ci-cd.yml there are github actions that run on each push and pull request. They test the project against 3 different version of python (3.7, 3.8, 3.9), runs autopep8, flake8 , run the tests. If everything passes, it then pushes the image to github public container registry then prints the docker iamge url as output

About

Python FastApi docker CI/CD Workflow This project is a showcase of how we can implement a CI/CD workflow on a fastApi based project ran in a Docker container The base FastAPI Image

Topics

autopep8cd-workflowdockerfastapiflake8

Resources

Readme
Activity

Stars

2 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.