Update Dockerfile
Browse files- Dockerfile +11 -10
Dockerfile
CHANGED
|
@@ -2,16 +2,17 @@
|
|
| 2 |
# MatAnyOne + SAM2 + Gradio Dockerfile (Python 3.10 + CUDA 12.1)
|
| 3 |
# ============================================================================
|
| 4 |
|
| 5 |
-
# Use Python 3.10
|
| 6 |
-
FROM
|
| 7 |
|
| 8 |
# Environment settings
|
| 9 |
ENV PYTHONDONTWRITEBYTECODE=1 \
|
| 10 |
PYTHONUNBUFFERED=1 \
|
| 11 |
DEBIAN_FRONTEND=noninteractive
|
| 12 |
|
| 13 |
-
# Install system dependencies
|
| 14 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
|
|
| 15 |
git wget curl build-essential cmake pkg-config \
|
| 16 |
ffmpeg libsm6 libxext6 libfontconfig1 libxrender1 \
|
| 17 |
libgl1-mesa-glx libglib2.0-0 \
|
|
@@ -27,21 +28,21 @@ WORKDIR /app
|
|
| 27 |
RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app
|
| 28 |
USER appuser
|
| 29 |
|
|
|
|
|
|
|
|
|
|
| 30 |
# Copy requirements for layer caching
|
| 31 |
COPY --chown=appuser:appuser requirements.txt .
|
| 32 |
|
| 33 |
-
# Upgrade pip + core tools
|
| 34 |
-
RUN pip install --no-cache-dir --user pip setuptools wheel
|
| 35 |
-
|
| 36 |
# Install PyTorch (CUDA 12.1 build)
|
| 37 |
-
RUN pip install --no-cache-dir --user \
|
| 38 |
torch==2.1.0 \
|
| 39 |
torchvision==0.16.0 \
|
| 40 |
torchaudio==2.1.0 \
|
| 41 |
--extra-index-url https://download.pytorch.org/whl/cu121
|
| 42 |
|
| 43 |
# Install core CV/scientific dependencies
|
| 44 |
-
RUN pip install --no-cache-dir --user \
|
| 45 |
numpy==1.26.4 \
|
| 46 |
opencv-python-headless==4.10.0.84 \
|
| 47 |
Pillow>=10.0.1,<11.0 \
|
|
@@ -49,7 +50,7 @@ RUN pip install --no-cache-dir --user \
|
|
| 49 |
av==12.1.0
|
| 50 |
|
| 51 |
# Install everything else from requirements.txt
|
| 52 |
-
RUN pip install --no-cache-dir --user -r requirements.txt
|
| 53 |
|
| 54 |
# Add user bin to PATH
|
| 55 |
ENV PATH="/home/appuser/.local/bin:$PATH"
|
|
@@ -75,4 +76,4 @@ HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
|
|
| 75 |
EXPOSE 7860
|
| 76 |
|
| 77 |
# Run application
|
| 78 |
-
CMD ["
|
|
|
|
| 2 |
# MatAnyOne + SAM2 + Gradio Dockerfile (Python 3.10 + CUDA 12.1)
|
| 3 |
# ============================================================================
|
| 4 |
|
| 5 |
+
# Use NVIDIA CUDA 12.1 base image with Python 3.10
|
| 6 |
+
FROM nvidia/cuda:12.1.0-cudnn8-runtime-ubuntu20.04
|
| 7 |
|
| 8 |
# Environment settings
|
| 9 |
ENV PYTHONDONTWRITEBYTECODE=1 \
|
| 10 |
PYTHONUNBUFFERED=1 \
|
| 11 |
DEBIAN_FRONTEND=noninteractive
|
| 12 |
|
| 13 |
+
# Install Python 3.10 and system dependencies
|
| 14 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 15 |
+
python3.10 python3.10-dev python3-pip python3.10-venv \
|
| 16 |
git wget curl build-essential cmake pkg-config \
|
| 17 |
ffmpeg libsm6 libxext6 libfontconfig1 libxrender1 \
|
| 18 |
libgl1-mesa-glx libglib2.0-0 \
|
|
|
|
| 28 |
RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app
|
| 29 |
USER appuser
|
| 30 |
|
| 31 |
+
# Upgrade pip and install wheel
|
| 32 |
+
RUN python3.10 -m pip install --no-cache-dir --user pip setuptools wheel
|
| 33 |
+
|
| 34 |
# Copy requirements for layer caching
|
| 35 |
COPY --chown=appuser:appuser requirements.txt .
|
| 36 |
|
|
|
|
|
|
|
|
|
|
| 37 |
# Install PyTorch (CUDA 12.1 build)
|
| 38 |
+
RUN python3.10 -m pip install --no-cache-dir --user \
|
| 39 |
torch==2.1.0 \
|
| 40 |
torchvision==0.16.0 \
|
| 41 |
torchaudio==2.1.0 \
|
| 42 |
--extra-index-url https://download.pytorch.org/whl/cu121
|
| 43 |
|
| 44 |
# Install core CV/scientific dependencies
|
| 45 |
+
RUN python3.10 -m pip install --no-cache-dir --user \
|
| 46 |
numpy==1.26.4 \
|
| 47 |
opencv-python-headless==4.10.0.84 \
|
| 48 |
Pillow>=10.0.1,<11.0 \
|
|
|
|
| 50 |
av==12.1.0
|
| 51 |
|
| 52 |
# Install everything else from requirements.txt
|
| 53 |
+
RUN python3.10 -m pip install --no-cache-dir --user -r requirements.txt
|
| 54 |
|
| 55 |
# Add user bin to PATH
|
| 56 |
ENV PATH="/home/appuser/.local/bin:$PATH"
|
|
|
|
| 76 |
EXPOSE 7860
|
| 77 |
|
| 78 |
# Run application
|
| 79 |
+
CMD ["python3.10", "app.py"]
|