-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
117 lines (104 loc) · 3.68 KB
/
Copy pathDockerfile
File metadata and controls
117 lines (104 loc) · 3.68 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# Copyright (c) 2026 SPHARX. All Rights Reserved. "From data intelligence emerges".
# deepness基础镜像
# 所有模块均基于此镜像构建
FROM nvidia/cuda:12.1.0-cudnn8-runtime-ubuntu22.04
ENV DEBIAN_FRONTEND=noninteractive \
TZ=Asia/Shanghai \
PATH=/opt/conda/bin:$PATH \
CUDA_HOME=/usr/local/cuda \
LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
# === 1. 系统库安装(包含 ORB-SLAM3 和 Pangolin 所需的所有依赖)===
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
cmake \
git \
wget \
ca-certificates \
# GUI/图形库
libgl1-mesa-glx \
libgl1-mesa-dri \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
libgomp1 \
libxi6 \
libx11-6 \
libglm-dev \
# USB/设备相关
libusb-1.0-0-dev \
udev \
# 多媒体处理
curl \
ffmpeg \
libavcodec-extra \
libavformat-dev \
libavutil-dev \
libswscale-dev \
libx264-dev \
libx265-dev \
libvpx-dev \
libtheora-dev \
libvorbis-dev \
libmp3lame-dev \
libopencore-amrnb-dev \
libopencore-amrwb-dev \
# 时区
tzdata \
# ORB-SLAM3 和 Pangolin 必需依赖 [citation:2]
libopencv-dev \
libeigen3-dev \
libboost-all-dev \
libglew-dev \
libpython3-dev \
&& ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& dpkg-reconfigure -f noninteractive tzdata \
&& rm -rf /var/lib/apt/lists/*
# === 2. 安装 Miniforge(多源下载)===
RUN set -ex; \
MINIFORGE_VERSION="23.11.0-0"; \
MINIFORGE_FILE="Miniforge3-Linux-x86_64.sh"; \
OFFICIAL_URL="https://github.com/conda-forge/miniforge/releases/download/${MINIFORGE_VERSION}/${MINIFORGE_FILE}"; \
TSINGHUA_URL="https://mirrors.tuna.tsinghua.edu.cn/github-release/conda-forge/miniforge/${MINIFORGE_VERSION}/${MINIFORGE_FILE}"; \
for url in $OFFICIAL_URL $TSINGHUA_URL; do \
if wget --timeout=30 --tries=2 -O Miniforge3.sh "$url"; then \
break; \
fi; \
done; \
bash Miniforge3.sh -b -p /opt/conda; \
rm Miniforge3.sh; \
/opt/conda/bin/conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/; \
/opt/conda/bin/conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/; \
/opt/conda/bin/conda config --set channel_priority flexible
# === 3. 创建基础 conda 环境(Python 3.11)===
ENV ENV_NAME=deepness-base \
PATH=/opt/conda/envs/deepness-base/bin:$PATH \
CONDA_DEFAULT_ENV=deepness-base
RUN /opt/conda/bin/conda install -n base -y mamba && \
/opt/conda/bin/mamba create -n $ENV_NAME python=3.11 -y
# === 4. 安装通用 Python 包(版本锁定)===
RUN /opt/conda/bin/mamba install -n $ENV_NAME -c conda-forge \
numpy=1.24.0 \
pyyaml=6.0.2 \
scipy=1.10.0 \
tqdm=4.66.0 \
-y
# === 5. 配置 pip 镜像源(清华源)===
RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
# === 6. 安装 PyTorch 及相关包(统一版本 2.5.1+cu121)[citation:3][citation:8] ===
RUN pip install --no-cache-dir \
torch==2.5.1+cu121 \
torchvision==0.20.1+cu121 \
torchaudio==2.5.1+cu121 \
--index-url https://download.pytorch.org/whl/cu121
# === 7. 创建目录结构(优化权限)===
RUN mkdir -p /app/common/{configs,schemas,scripts,patches} \
&& mkdir -p /app/partdata/{deps,models,logs} \
&& chmod 777 /app/partdata/logs
# === 8. 创建非 root 用户 ===
RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app
# === 9. 清理缓存(减小镜像体积)===
RUN conda clean -afy && pip cache purge && rm -rf /root/.cache/pip
WORKDIR /app
USER appuser
CMD ["/bin/bash"]