Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +9 -29
Dockerfile
CHANGED
|
@@ -1,34 +1,14 @@
|
|
| 1 |
-
# Use
|
| 2 |
-
FROM python:3.10
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
ENV PYTHONUNBUFFERED=1 \
|
| 6 |
-
PYTHONDONTWRITEBYTECODE=1 \
|
| 7 |
-
PORT=8000 \
|
| 8 |
-
HOST=0.0.0.0
|
| 9 |
-
|
| 10 |
-
# Create and set working directory
|
| 11 |
-
WORKDIR /app
|
| 12 |
-
|
| 13 |
-
# Install system dependencies
|
| 14 |
-
RUN apt-get update && apt-get install -y \
|
| 15 |
-
build-essential \
|
| 16 |
-
curl \
|
| 17 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 18 |
-
|
| 19 |
-
# Copy requirements first for caching
|
| 20 |
-
COPY requirements.txt .
|
| 21 |
-
|
| 22 |
-
# Install Python dependencies
|
| 23 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
| 24 |
-
|
| 25 |
-
# Copy the rest of the app
|
| 26 |
COPY . .
|
| 27 |
|
| 28 |
-
#
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
# Start the FastAPI app with Uvicorn
|
| 32 |
-
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
|
| 33 |
|
|
|
|
|
|
|
| 34 |
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use the official Python 3.10.9 image
|
| 2 |
+
FROM python:3.10.18
|
| 3 |
|
| 4 |
+
# Copy the current directory contents into the container at .
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
COPY . .
|
| 6 |
|
| 7 |
+
# Set the working directory to /
|
| 8 |
+
WORKDIR /
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
+
# Install requirements.txt
|
| 11 |
+
RUN pip install --no-cache-dir --upgrade -r /requirements.txt
|
| 12 |
|
| 13 |
+
# Start the FastAPI app on port 7860, the default port expected by Spaces
|
| 14 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|