Spaces:
Sleeping
Sleeping
Create dockerFile
Browse files- dockerFile +21 -0
dockerFile
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.11-slim
|
| 2 |
+
# Use a lightweight Python 3.11 base image
|
| 3 |
+
|
| 4 |
+
WORKDIR /app
|
| 5 |
+
# All subsequent commands run in /app
|
| 6 |
+
|
| 7 |
+
COPY requirements.txt .
|
| 8 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 9 |
+
# Install dependencies BEFORE copying code
|
| 10 |
+
# (Docker caches this layer — faster rebuilds)
|
| 11 |
+
|
| 12 |
+
COPY . .
|
| 13 |
+
# Copy all your files into the container
|
| 14 |
+
|
| 15 |
+
EXPOSE 7860
|
| 16 |
+
# Must match app_port in README.md
|
| 17 |
+
|
| 18 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
| 19 |
+
# uvicorn = the server that runs FastAPI
|
| 20 |
+
# main:app = "from main.py, use the 'app' object"
|
| 21 |
+
# --host 0.0.0.0 = listen on all network interfaces (required in containers)
|