Welcome to the FastAPI-Docker-GitHub-Actions Lab! This repository serves as an educational example of a CI/CD project that demonstrates the usage of GitHub Actions for deploying a simple FastAPI server. Key components include:
- Source Code: Python Runtime
- Dependency Management: Python Poetry
- Web Framework: FastAPI
- Containerization Tools: Docker and Docker-Compose
- Testing: PyTest Framework and Coverage
- Artifact Repository: DockerHub
- Continuous Integration/Continuous Delivery (CI/CD): GitHub Actions
The core idea is to have a CI/CD pipeline that illustrates the automation with Continuous Integration, however, you can follow these steps to configure/run the project locally:
Begin by cloning this repository to your local machine:
git clone https://github.com/san99tiago/fastapi-docker-github-actions
cd fastapi-docker-github-actions
To manage Python dependencies and create a virtual environment, install Poetry following the instructions for your preferred installation method:
Once Poetry is installed, execute the following commands for its setup:
poetry shell
poetry install
To run the FastAPI server with Uvicorn, use the following command:
poe fastapi-local
For an easy way to run the FastAPI server as a Docker container using Docker-Compose, use the following commands:
# Start the service
poe fastapi-docker-up
# Stop the service
poe fastapi-docker-down
After running the server using the previous commands, open your preferred tool for making API requests and try the following REST-API endpoints:
[GET]
: http://127.0.0.1:8000/[GET]
: http://127.0.0.1:8000/status
A big thank you to all the dedicated contributors who have made the open-source projects used in this repository possible.
This repository's content is inspired by multiple online resources. Please feel free to use it as a guide for your future projects.!
As a Curious DevOps Engineer, I am deeply passionate about implementing cutting-edge cloud-based solutions on AWS. |
Copyright 2023 Santiago Garcia Arango