File size: 1,271 Bytes
e813431
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Dockerized FastAPI LLM Setup

This repository contains a FastAPI application packaged inside a Docker container for easy deployment and scalability. Follow the steps below to build and run the containerized FastAPI application.

## Prerequisites

Ensure you have the following installed on your system before proceeding:

- Docker (https://docs.docker.com/get-docker/)

## Steps to Build and Run the Dockerized FastAPI Application

Build the Docker Image
Run the following command to build the Docker image from the Dockerfile in your project directory. This will create a Docker image named `my-fastapi-app`:

`docker build -t my-fastapi-app .`

Run the Docker Container
Once the image is built, you can run the container and map it to port `8000` on your local machine. Use the following command:

`docker run -p 8000:8000 my-fastapi-app`

Explanation: - `-p 8000:8000`: Maps port 8000 on your local machine to port 8000 inside the Docker container, making the FastAPI app accessible at `http://localhost:8000`.

Access the Application
After running the container, the FastAPI app should be accessible at:

`http://localhost:8000`

You can interact with the API and view the automatically generated documentation provided by FastAPI at:

`http://localhost:8000/docs`