Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +8 -2
Dockerfile
CHANGED
|
@@ -5,6 +5,7 @@ WORKDIR /app
|
|
| 5 |
# Install system dependencies
|
| 6 |
RUN apt-get update && apt-get install -y \
|
| 7 |
build-essential \
|
|
|
|
| 8 |
&& rm -rf /var/lib/apt/lists/*
|
| 9 |
|
| 10 |
# Copy requirements and install
|
|
@@ -14,8 +15,13 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|
| 14 |
# Copy the application code
|
| 15 |
COPY . .
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
# Expose the port FastAPI runs on
|
| 18 |
EXPOSE 7860
|
| 19 |
|
| 20 |
-
# Command to run the application
|
| 21 |
-
|
|
|
|
|
|
| 5 |
# Install system dependencies
|
| 6 |
RUN apt-get update && apt-get install -y \
|
| 7 |
build-essential \
|
| 8 |
+
git \
|
| 9 |
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
|
| 11 |
# Copy requirements and install
|
|
|
|
| 15 |
# Copy the application code
|
| 16 |
COPY . .
|
| 17 |
|
| 18 |
+
# Set environment variables for the ML engine
|
| 19 |
+
ENV PYTHONUNBUFFERED=1
|
| 20 |
+
ENV PORT=7860
|
| 21 |
+
|
| 22 |
# Expose the port FastAPI runs on
|
| 23 |
EXPOSE 7860
|
| 24 |
|
| 25 |
+
# Command to run the application using gunicorn for higher stability
|
| 26 |
+
# We use uvicorn workers for high-concurrency FastAPI support
|
| 27 |
+
CMD ["gunicorn", "app:app", "--workers", "1", "--worker-class", "uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:7860", "--timeout", "600"]
|