Skip to content

airusong/fastapi-from-zero

 
 

Repository files navigation

CI

fastapi-from-zero

A repository to demonstrate FastAPI

/docs get to swagger

fastapi

Docker

docker build . docker image ls #find image docker run -p 127.0.0.1:8080:8080 93fa55efa692

Cloud9 + ECR + App Runner

continuous-delivery

  • Clone repo into Cloud9 (pick a machine with decent size CPU and RAM if possible, but students should use micro)
  • Add ssh keys to GitHub
  • resize to bigger disk
  • Create virtualenv and add to bashrc and source python3 -m venv ~/.venv && echo 'source ~/.venv/bin/activate' >> ~/.bashrc && source ~/.bashrc
  • cd into checkout and run make install
  • Preview running FastAPI app after running: python main.py

Screen Shot 2022-09-28 at 12 32 52 PM

  • Create ECR repository by right-click in Cloud9

Screen Shot 2022-09-28 at 12 34 44 PM

  • Navigate to ECR repo created or whatever you named it and follow "push" instructions

    Screen Shot 2022-09-28 at 12 36 45 PM
  • Navigate to AWS App Runner and Setup Continuous Delivery using ECR

    Screen Shot 2022-09-28 at 12 41 21 PM
  • Setup AWS Code Build to push container after each build (which triggers auto-deploy)

    Screen Shot 2022-09-28 at 12 50 19 PM

See following buildspec.yml and Makefile

References

About

A repository to demonstrate FastAPI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 76.7%
  • Makefile 18.1%
  • Dockerfile 5.2%