Skip to content

smith8ca/fastapi-container-app

Repository files navigation

fastapi-container-app

Generate SSL Certificates

To create new SSL certificates, run the following from the root directory and provide the necessary information on the command line:

openssl req -x509 -newkey rsa:4096 -nodes -out ssl/cert.pem -keyout ssl/key.pem -days 365

Run Locally

To run the application locally, execute the following from the root directory:

uvicorn main:app --host 0.0.0.0 --port 443 --ssl-keyfile ssl/key.pem --ssl-certfile ssl/cert.pem

The API application can also be launched with fastapi:

fastapi run main.py --host 0.0.0.0 --port 80

Docker Container Development

Build docker image:

docker build -t smith8ca/fastapi-container-app .

Run the docker image:

docker run -d --name fastapi -p 443:443 smith8ca/fastapi-container-app

Sources & References

About

A sample FastAPI application that can be run standalone or as a Docker container.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published