Simple fastapi skeleton for a stateless microservice (application for ml models, optimization, ...)
To run the service manually in debug mode install the required python dependencies:
poetry install
You can run the service in debug mode without gunicorn:
./run_debug.sh
To build the Docker image:
docker build -t "fastapi-api:latest" . --build-arg FASTAPI_ENV=develop
To run the Docker image:
docker run -p 5000:5000 -ti fastapi-api:latest
To check that the service is alive, run:
curl -X GET "http://localhost:5000/health" -H "accept: application/json"
curl -X GET "http://localhost:5000/v1/health" -H "accept: application/json"
The user interface for the API is defined in http://localhost:5000/docs
endpoint.
To run the tests:
poetry run python -m pytest --verbose --cov=./