Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +83 -58
Dockerfile
CHANGED
|
@@ -1,62 +1,87 @@
|
|
| 1 |
-
#
|
| 2 |
-
FROM
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
|
|
|
|
|
|
|
| 6 |
|
| 7 |
-
|
| 8 |
-
COPY . .
|
| 9 |
|
| 10 |
-
#
|
| 11 |
RUN apt-get update && apt-get install -y \
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
RUN --
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use CUDA-enabled base image for GPU support
|
| 2 |
+
FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04
|
| 3 |
|
| 4 |
+
# Set environment variables
|
| 5 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
| 6 |
+
ENV PYTHONUNBUFFERED=1
|
| 7 |
+
ENV CUDA_HOME=/usr/local/cuda-11.8
|
| 8 |
|
| 9 |
+
WORKDIR /app
|
|
|
|
| 10 |
|
| 11 |
+
# Install system dependencies
|
| 12 |
RUN apt-get update && apt-get install -y \
|
| 13 |
+
python3.10 \
|
| 14 |
+
python3-pip \
|
| 15 |
+
git \
|
| 16 |
+
wget \
|
| 17 |
+
libglib2.0-0 \
|
| 18 |
+
libsm6 \
|
| 19 |
+
libxext6 \
|
| 20 |
+
libxrender-dev \
|
| 21 |
+
libgomp1 \
|
| 22 |
+
libgl1-mesa-glx \
|
| 23 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 24 |
+
|
| 25 |
+
# Create symbolic links for python
|
| 26 |
+
RUN ln -sf /usr/bin/python3.10 /usr/bin/python && \
|
| 27 |
+
ln -sf /usr/bin/pip3 /usr/bin/pip
|
| 28 |
+
|
| 29 |
+
# Upgrade pip
|
| 30 |
+
RUN pip install --upgrade pip setuptools wheel
|
| 31 |
+
|
| 32 |
+
# ===== CRITICAL: Install packages in EXACT ORDER to maintain compatibility =====
|
| 33 |
+
|
| 34 |
+
# Step 1: Install NumPy 1.26.4 FIRST (LOCKED)
|
| 35 |
+
RUN pip install --no-cache-dir numpy==1.26.4
|
| 36 |
+
|
| 37 |
+
# Step 2: Install compatible scientific packages
|
| 38 |
+
RUN pip install --no-cache-dir \
|
| 39 |
+
scipy==1.11.4 \
|
| 40 |
+
scikit-learn==1.3.2 \
|
| 41 |
+
matplotlib==3.7.2
|
| 42 |
+
|
| 43 |
+
# Step 3: Install PyTorch with CUDA 11.8 support
|
| 44 |
+
RUN pip install --no-cache-dir \
|
| 45 |
+
torch==2.1.0 \
|
| 46 |
+
torchvision==0.16.0 \
|
| 47 |
+
torchaudio==2.1.0 \
|
| 48 |
+
--index-url https://download.pytorch.org/whl/cu118
|
| 49 |
+
|
| 50 |
+
# Step 4: Install AI/ML packages with LOCKED versions
|
| 51 |
+
RUN pip install --no-cache-dir \
|
| 52 |
+
huggingface_hub==0.20.0 \
|
| 53 |
+
safetensors==0.4.1 \
|
| 54 |
+
diffusers==0.25.0 \
|
| 55 |
+
transformers==4.36.0 \
|
| 56 |
+
accelerate==0.28.0 \
|
| 57 |
+
peft==0.8.2
|
| 58 |
+
|
| 59 |
+
# Step 5: Install computer vision and utility packages
|
| 60 |
+
RUN pip install --no-cache-dir \
|
| 61 |
+
opencv-python-headless==4.8.1.78 \
|
| 62 |
+
pillow
|
| 63 |
+
|
| 64 |
+
# Step 6: Install additional dependencies
|
| 65 |
+
RUN pip install --no-cache-dir \
|
| 66 |
+
fvcore \
|
| 67 |
+
iopath \
|
| 68 |
+
av \
|
| 69 |
+
omegaconf
|
| 70 |
+
|
| 71 |
+
# Step 7: Install Gradio for web interface (Hugging Face Spaces)
|
| 72 |
+
RUN pip install --no-cache-dir gradio
|
| 73 |
+
|
| 74 |
+
# Step 8: Force reinstall huggingface_hub to lock version (prevent auto-upgrades)
|
| 75 |
+
RUN pip install --force-reinstall --no-cache-dir huggingface_hub==0.20.0 --no-deps
|
| 76 |
+
|
| 77 |
+
# Copy application code
|
| 78 |
+
COPY . /app
|
| 79 |
+
|
| 80 |
+
# Create necessary directories
|
| 81 |
+
RUN mkdir -p /app/models /app/outputs
|
| 82 |
+
|
| 83 |
+
# Expose port for Hugging Face Spaces (default: 7860)
|
| 84 |
+
EXPOSE 7860
|
| 85 |
+
|
| 86 |
+
# Set the entrypoint
|
| 87 |
+
CMD ["python", "app.py"]
|