# Use NVIDIA CUDA base image for GPU support | |
FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04 | |
# Set environment variables | |
ENV DEBIAN_FRONTEND=noninteractive | |
ENV PYTHONUNBUFFERED=1 | |
ENV TORCH_CUDA_ARCH_LIST="6.0 6.1 7.0 7.5 8.0 8.6+PTX" | |
# Install system dependencies | |
RUN apt-get update && apt-get install -y \ | |
python3 \ | |
python3-pip \ | |
python3-dev \ | |
git \ | |
wget \ | |
curl \ | |
build-essential \ | |
cmake \ | |
libgl1-mesa-glx \ | |
libglib2.0-0 \ | |
libsm6 \ | |
libxext6 \ | |
libxrender-dev \ | |
libgomp1 \ | |
libgcc-s1 \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Create working directory | |
WORKDIR /app | |
# Copy requirements first (for better Docker layer caching) | |
COPY requirements.txt . | |
# Install Python dependencies | |
RUN pip3 install --no-cache-dir --upgrade pip setuptools wheel | |
RUN pip3 install --no-cache-dir -r requirements.txt | |
# Go back to app directory | |
WORKDIR /app | |
# Copy the application code | |
COPY . . | |
# Set up DepthAnythingV2 | |
#WORKDIR /app/Depth-Anything-V2 | |
#RUN pip3 install -e . | |
#WORKDIR /app | |
# Create directories for models and cache | |
RUN mkdir -p /app/models /root/.cache | |
# Download DepthAnythingV2 weights (you can add this step or mount as volume) | |
# Uncomment the line below if you want to download weights during build | |
# RUN wget -O depth_anything_v2_metric_vkitti_vitl.pth https://huggingface.co/depth-anything/Depth-Anything-V2-Metric-VKITTI-Small/resolve/main/depth_anything_v2_metric_vkitti_vitl.pth | |
# Expose the port | |
EXPOSE 7860 | |
# Set the entry point | |
CMD ["python3", "enhanced_app.py"] |