Spaces:
Running
on
Zero
Running
on
Zero
Create Dockerfile
Browse files- Dockerfile +42 -0
Dockerfile
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use official PyTorch image with CUDA support
|
| 2 |
+
FROM pytorch/pytorch:2.1.0-cuda118-runtime
|
| 3 |
+
|
| 4 |
+
# Set working directory
|
| 5 |
+
WORKDIR /workspace
|
| 6 |
+
|
| 7 |
+
# Install system dependencies
|
| 8 |
+
RUN apt-get update && apt-get install -y \
|
| 9 |
+
git \
|
| 10 |
+
ffmpeg \
|
| 11 |
+
libgl1 \
|
| 12 |
+
libsm6 \
|
| 13 |
+
libxext6 \
|
| 14 |
+
cmake \
|
| 15 |
+
build-essential \
|
| 16 |
+
curl \
|
| 17 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 18 |
+
|
| 19 |
+
# Optional: Install CUDA Toolkit (only needed if compiling from source)
|
| 20 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 21 |
+
cuda-toolkit-11-8 && \
|
| 22 |
+
ln -s /usr/local/cuda-11.8 /usr/local/cuda && \
|
| 23 |
+
rm -rf /var/lib/apt/lists/*
|
| 24 |
+
|
| 25 |
+
ENV CUDA_HOME=/usr/local/cuda
|
| 26 |
+
ENV PATH=${PATH}:/usr/local/cuda/bin
|
| 27 |
+
|
| 28 |
+
# Copy requirements.txt
|
| 29 |
+
COPY requirements.txt .
|
| 30 |
+
|
| 31 |
+
# Install Python dependencies
|
| 32 |
+
RUN pip install --no-cache-dir -U pip && \
|
| 33 |
+
pip install --no-cache-dir -r requirements.txt
|
| 34 |
+
|
| 35 |
+
# Copy app code
|
| 36 |
+
COPY . .
|
| 37 |
+
|
| 38 |
+
# Expose port
|
| 39 |
+
EXPOSE 7860
|
| 40 |
+
|
| 41 |
+
# Run the app
|
| 42 |
+
CMD ["python", "app.py"]
|