Create Dockerfile
Browse files- Dockerfile +22 -0
Dockerfile
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Dockerfile for Hugging Face Spaces (FastAPI)
|
2 |
+
|
3 |
+
# Use a pre-built, optimized base image from the creator of FastAPI
|
4 |
+
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.10-slim
|
5 |
+
|
6 |
+
# Set the working directory inside the container
|
7 |
+
WORKDIR /app
|
8 |
+
|
9 |
+
# Copy the dependency and data files first
|
10 |
+
COPY requirements.txt .
|
11 |
+
COPY knowledge_base.json .
|
12 |
+
|
13 |
+
# Install the Python libraries from the requirements file
|
14 |
+
RUN pip install --no-cache-dir --upgrade pip && \
|
15 |
+
pip install --no-cache-dir -r requirements.txt
|
16 |
+
|
17 |
+
# Copy the main application code
|
18 |
+
COPY main.py .
|
19 |
+
|
20 |
+
# The base image (uvicorn-gunicorn-fastapi) automatically knows
|
21 |
+
# how to find and run the 'app' object from 'main.py' on port 8000.
|
22 |
+
# So, no CMD or EXPOSE instruction is needed.
|