This is a guide on how to deploy a Crop Production Prediction Model
using FastAPI in a Docker container.
Docker installed on your local machine
-
Clone the repository into your local machine.
-
Navigate into the project directory.
-
cd to-
this-folder
docker build -t crop-production-prediction-model .
The image should be built successfully if you see the output similar to the following:
Successfully built e1d1007e8d2e
Successfully tagged crop-production-prediction-model:latest
Once the image has been built, run the container using the following command:
docker run -p 8000:8000 crop-production-prediction-model
-
This command will start a container with the name
crop-production-prediction-model
, map port8000
from the container to port8000
on the host, and run thecrop-production-prediction-model
image. -
You can now access the API at
http://localhost:8000/docs
in your browser or using an API testing tool like Postman.
- To stop the container, run the following command:
docker stop crop-production-prediction-model
- To remove the container, run the following command:
docker rm crop-production-prediction-model
You have successfully deployed a Crop Production Model using FastAPI in a Docker container.