Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +14 -12
Dockerfile
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
|
|
| 1 |
FROM python:3.11-slim
|
| 2 |
|
| 3 |
-
#
|
| 4 |
RUN pip install --no-cache-dir --upgrade pip setuptools wheel
|
| 5 |
|
|
|
|
| 6 |
WORKDIR /app
|
| 7 |
|
| 8 |
-
#
|
| 9 |
-
|
| 10 |
|
| 11 |
-
#
|
| 12 |
-
#
|
|
|
|
| 13 |
|
| 14 |
-
#
|
| 15 |
-
COPY requirements.txt .
|
| 16 |
-
COPY main.py .
|
| 17 |
-
|
| 18 |
-
# 4) install remaining deps
|
| 19 |
-
# make sure requirements.txt no longer lists python-fasthtml
|
| 20 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 21 |
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 1) Start from a small Python base
|
| 2 |
FROM python:3.11-slim
|
| 3 |
|
| 4 |
+
# 2) Upgrade pip, setuptools, wheel (avoids old‐pip bugs)
|
| 5 |
RUN pip install --no-cache-dir --upgrade pip setuptools wheel
|
| 6 |
|
| 7 |
+
# 3) Set the working dir
|
| 8 |
WORKDIR /app
|
| 9 |
|
| 10 |
+
# 4) Copy your entire repo into the container
|
| 11 |
+
COPY . .
|
| 12 |
|
| 13 |
+
# 5) Install your local package from src/ first
|
| 14 |
+
# (assumes src/ has a setup.py or pyproject.toml at its root)
|
| 15 |
+
RUN pip install --no-cache-dir ./src
|
| 16 |
|
| 17 |
+
# 6) Now install all the other deps
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 19 |
|
| 20 |
+
# 7) Expose the port your app uses
|
| 21 |
+
EXPOSE 5001
|
| 22 |
+
|
| 23 |
+
# 8) Launch FastAPI via Uvicorn
|
| 24 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "5001"]
|