-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
114 lines (90 loc) · 3.01 KB
/
Copy pathDockerfile
File metadata and controls
114 lines (90 loc) · 3.01 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
# DeviceEmulator Dockerfile
FROM pytorch/pytorch:2.11.0-cuda12.8-cudnn9-devel
RUN sed -i 's|http://security.ubuntu.com/ubuntu|http://archive.ubuntu.com/ubuntu|g' /etc/apt/sources.list || true
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y \
curl \
wget \
git \
build-essential \
pkg-config
# Install Nsight Systems (nsys) and Nsight Compute (ncu)
RUN apt-get update && apt-get install -y \
nsight-systems-2025.5.2 \
nsight-compute-2025.4.1
RUN apt-get install -y \
cmake \
ninja-build \
ccache
RUN apt-get install -y \
libssl-dev \
protobuf-compiler \
libgrpc-dev \
libgrpc++-dev
RUN apt-get install -y \
libfmt-dev \
libspdlog-dev
RUN apt-get install -y \
libevent-dev
RUN apt-get update && apt-get install -y \
libxml2-dev \
xsltproc \
uuid-dev \
libhiredis-dev \
rapidjson-dev \
libxslt1-dev
RUN apt-get update && apt-get install -y \
gdb \
vim \
nano \
psmisc \
tmux \
iputils-ping \
lsof \
net-tools
RUN apt-get install -y libopenblas-dev
# PyTorch 2.11 image uses PEP 668 EXTERNALLY-MANAGED.
# Safe to remove in a Docker container.
RUN rm -f /usr/lib/python3.12/EXTERNALLY-MANAGED
# 创建工作目录
WORKDIR /app
# copy requirements.txt first to leverage Docker cache
COPY requirements.txt /app/
RUN pip install --no-cache -r /app/requirements.txt
# Copy the rest of the project files
COPY . /app/
# Remove old .so files that would shadow the newly built package
RUN rm -f /app/morphling/*.so
# ccache: persist compiler cache across Docker builds (requires BuildKit)
ARG USE_CCACHE=1
ENV CCACHE_DIR=/ccache
RUN if [ "$USE_CCACHE" = "1" ]; then ccache -M 5G; fi
# --no-build-isolation (below) does not install build-system.requires, and the
# build context excludes .git; install setuptools-scm and inject the git-derived
# version via a build arg (empty => pyproject [tool.setuptools_scm] fallback).
RUN pip install --no-cache "setuptools-scm>=8"
ARG MORPHLING_VERSION
ENV SETUPTOOLS_SCM_PRETEND_VERSION_FOR_MORPHLING=${MORPHLING_VERSION}
# 构建和安装项目(使用系统 python)with BuildKit cache mount for ccache
RUN --mount=type=cache,target=/ccache \
if [ "$USE_CCACHE" = "1" ]; then export PATH="/usr/lib/ccache:$PATH"; fi && \
pip install --no-build-isolation --verbose ./
# Build standalone C++ tests (enable all optional suites)
RUN --mount=type=cache,target=/ccache \
if [ "$USE_CCACHE" = "1" ]; then export PATH="/usr/lib/ccache:$PATH"; fi && \
cmake -S tests/cpp -B tests/cpp/build \
-DENABLE_CUDA_TESTS=ON \
-DENABLE_XTGEMM_TESTS=ON \
-DENABLE_ZEROCOPY_TESTS=ON \
-DENABLE_GREEN_CTX_TESTS=ON && \
cmake --build tests/cpp/build -j
# 创建必要的目录
RUN mkdir -p /app/logs /app/data /app/config
# 设置权限
RUN chmod +x /app/scripts/*.sh || true && chmod +x /app/csrc/*.sh || true
# 暴露端口
EXPOSE 39000
# 设置环境变量用于运行时
ENV SPDLOG_LEVEL=debug
ENV MORPHLING_HOME=/app
ENV PYTHONPATH=/usr/local/lib/python3.12/dist-packages