Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +22 -10
Dockerfile
CHANGED
|
@@ -1,21 +1,33 @@
|
|
| 1 |
-
|
|
|
|
| 2 |
|
| 3 |
-
# Set environment variables for
|
| 4 |
-
ENV
|
| 5 |
-
ENV
|
| 6 |
|
| 7 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
WORKDIR /app
|
| 9 |
|
| 10 |
-
#
|
| 11 |
COPY requirements.txt .
|
| 12 |
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
-
# Copy application code
|
| 15 |
COPY . .
|
| 16 |
|
| 17 |
-
# Expose
|
| 18 |
EXPOSE 7860
|
| 19 |
|
| 20 |
-
#
|
| 21 |
-
CMD ["python", "app.py"]
|
|
|
|
| 1 |
+
# Use a Python base image
|
| 2 |
+
FROM python:3.9-slim
|
| 3 |
|
| 4 |
+
# Set environment variables to prevent bytecode generation and buffer output for logging
|
| 5 |
+
ENV PYTHONDONTWRITEBYTECODE=1
|
| 6 |
+
ENV PYTHONUNBUFFERED=1
|
| 7 |
|
| 8 |
+
# Install system dependencies
|
| 9 |
+
RUN apt-get update && apt-get install -y \
|
| 10 |
+
gcc \
|
| 11 |
+
libgl1-mesa-glx \
|
| 12 |
+
libglib2.0-0 \
|
| 13 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 14 |
+
|
| 15 |
+
# Set the working directory in the container
|
| 16 |
WORKDIR /app
|
| 17 |
|
| 18 |
+
# Copy requirements.txt and install Python dependencies
|
| 19 |
COPY requirements.txt .
|
| 20 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 21 |
+
RUN pip install accelerate
|
| 22 |
+
|
| 23 |
+
COPY model /app/model
|
| 24 |
+
|
| 25 |
|
| 26 |
+
# Copy the application code into the container
|
| 27 |
COPY . .
|
| 28 |
|
| 29 |
+
# Expose the port your application will run on
|
| 30 |
EXPOSE 7860
|
| 31 |
|
| 32 |
+
# Define the command to run your FastAPI application
|
| 33 |
+
CMD ["python", "app.py"]
|