-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
68 lines (49 loc) · 2.46 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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
63
64
65
66
67
68
# ------------------------------------------------------------------------------------------------ #
# (c) MIT License, Tremeschin
# Dockerfile v2024.12.4
# ------------------------------------------------------------------------------------------------ #
# General metadata and configuration
FROM python:3.12.1-slim-bullseye
RUN apt update
# ------------------------------------------------------------------------------------------------ #
# Make Vulkan and OpenGL EGL acceleration work on NVIDIA (the unveiled magic of nvidia/glvnd)
# Nvidia container toolkit configuration
ENV NVIDIA_DRIVER_CAPABILITIES="all"
ENV NVIDIA_VISIBLE_DEVICES="all"
# Don't use llvmpipe (software rendering) on WSL
ENV MESA_D3D12_DEFAULT_ADAPTER_NAME="NVIDIA"
ENV LD_LIBRARY_PATH="/usr/lib/wsl/lib"
# (ShaderFlow) Don't use glfw
ENV WINDOW_BACKEND="headless"
# Add libEGL ICD loader and libraries
RUN apt install -y libglvnd0 libglvnd-dev libegl1-mesa-dev && \
mkdir -p /usr/share/glvnd/egl_vendor.d && \
echo '{"file_format_version":"1.0.0","ICD":{"library_path":"libEGL_nvidia.so.0"}}' > \
/usr/share/glvnd/egl_vendor.d/10_nvidia.json
# Add Vulkan ICD and libraries
RUN apt install -y libvulkan1 libvulkan-dev && \
mkdir -p /usr/share/vulkan/icd.d && \
echo '{"file_format_version":"1.0.0","ICD":{"library_path":"libGLX_nvidia.so.0","api_version":"1.3"}}' > \
/usr/share/vulkan/icd.d/nvidia_icd.json
RUN apt install -y xorg-dev libglu1-mesa-dev
# ------------------------------------------------------------------------------------------------ #
# Video encoding and decoding
RUN apt install -y xz-utils curl
ARG FFMPEG="ffmpeg-master-latest-linux64-gpl"
RUN curl -L "https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/${FFMPEG}.tar.xz" | \
tar -xJ --strip-components=2 --exclude="doc" --exclude="man" -C /usr/local/bin
# Cache depth estimator models
RUN pip install huggingface-hub
RUN huggingface-cli download "depth-anything/Depth-Anything-V2-small-hf" && \
huggingface-cli download "depth-anything/Depth-Anything-V2-base-hf"
# Install a PyTorch flavor
ARG TORCH_VERSION="2.5.1"
ARG TORCH_FLAVOR="cpu"
RUN pip install torch=="${TORCH_VERSION}+${TORCH_FLAVOR}" \
--index-url "https://download.pytorch.org/whl/${TORCH_FLAVOR}"
RUN pip install transformers
RUN pip install runpod
RUN pip install depthflow
# ------------------------------------------------------------------------------------------------ #
COPY depthflow.py /depthflow.py
CMD ["python3", "/depthflow.py"]