Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +14 -5
Dockerfile
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
-
# Install system dependencies
|
| 6 |
RUN apt-get update && apt-get install -y \
|
| 7 |
git \
|
| 8 |
git-lfs \
|
|
@@ -12,19 +14,26 @@ RUN apt-get update && apt-get install -y \
|
|
| 12 |
cmake \
|
| 13 |
rsync \
|
| 14 |
libgl1 \
|
|
|
|
| 15 |
&& rm -rf /var/lib/apt/lists/* \
|
| 16 |
&& git lfs install
|
| 17 |
|
| 18 |
-
#
|
| 19 |
COPY requirements.txt .
|
| 20 |
RUN pip install --no-cache-dir --upgrade pip && \
|
| 21 |
pip install --no-cache-dir -r requirements.txt
|
| 22 |
|
| 23 |
-
# Copy
|
| 24 |
COPY . .
|
| 25 |
|
| 26 |
-
#
|
|
|
|
|
|
|
|
|
|
| 27 |
EXPOSE 7860
|
| 28 |
|
| 29 |
-
#
|
|
|
|
|
|
|
|
|
|
| 30 |
CMD ["python", "app.py"]
|
|
|
|
| 1 |
+
# Use Python 3.10 slim image for compatibility with torch 2.1.0
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
| 4 |
+
# Set working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
+
# Install system dependencies required for torch, diffusers, and image processing
|
| 8 |
RUN apt-get update && apt-get install -y \
|
| 9 |
git \
|
| 10 |
git-lfs \
|
|
|
|
| 14 |
cmake \
|
| 15 |
rsync \
|
| 16 |
libgl1 \
|
| 17 |
+
libglib2.0-0 \
|
| 18 |
&& rm -rf /var/lib/apt/lists/* \
|
| 19 |
&& git lfs install
|
| 20 |
|
| 21 |
+
# Upgrade pip and install Python dependencies
|
| 22 |
COPY requirements.txt .
|
| 23 |
RUN pip install --no-cache-dir --upgrade pip && \
|
| 24 |
pip install --no-cache-dir -r requirements.txt
|
| 25 |
|
| 26 |
+
# Copy application code
|
| 27 |
COPY . .
|
| 28 |
|
| 29 |
+
# Create directory for local image backups
|
| 30 |
+
RUN mkdir -p generated_images_backup
|
| 31 |
+
|
| 32 |
+
# Expose the port Hugging Face expects
|
| 33 |
EXPOSE 7860
|
| 34 |
|
| 35 |
+
# Set environment variables
|
| 36 |
+
ENV PYTHONUNBUFFERED=1
|
| 37 |
+
|
| 38 |
+
# Run the application
|
| 39 |
CMD ["python", "app.py"]
|