Skip to content

Commit a0fd23a

Browse files
committed
Add image cleanup
Signed-off-by: Alexey Rivkin <[email protected]>
1 parent 9da2ca3 commit a0fd23a

File tree

1 file changed

+25
-11
lines changed

1 file changed

+25
-11
lines changed

contrib/Dockerfile

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -83,40 +83,50 @@ RUN apt-get update -y && \
8383
pciutils \
8484
libpci-dev \
8585
libibmad-dev \
86-
doxygen
86+
doxygen && \
87+
apt-get clean && \
88+
rm -rf /var/lib/apt/lists/*
8789

8890
# Add DOCA repository and install packages
8991
RUN ARCH_SUFFIX=$(if [ "${ARCH}" = "aarch64" ]; then echo "arm64"; else echo "amd64"; fi) && \
9092
MELLANOX_OS="$(. /etc/lsb-release; echo ${DISTRIB_ID}${DISTRIB_RELEASE} | tr A-Z a-z | tr -d .)" && \
9193
wget --tries=3 --waitretry=5 --no-verbose https://www.mellanox.com/downloads/DOCA/DOCA_v3.1.0/host/doca-host_3.1.0-091000-25.07-${MELLANOX_OS}_${ARCH_SUFFIX}.deb -O doca-host.deb && \
9294
dpkg -i doca-host.deb && \
95+
rm -f doca-host.deb && \
9396
apt-get update && \
9497
apt-get upgrade -y && \
95-
apt-get install -y --no-install-recommends doca-sdk-gpunetio libdoca-sdk-gpunetio-dev libdoca-sdk-verbs-dev
98+
apt-get install -y --no-install-recommends doca-sdk-gpunetio libdoca-sdk-gpunetio-dev libdoca-sdk-verbs-dev && \
99+
apt-get clean && \
100+
rm -rf /var/lib/apt/lists/*
96101

97102
# Force reinstall of RDMA packages from DOCA repository
98103
# Reinstall needed to fix broken libibverbs-dev, which may lead to lack of Infiniband support.
99104
# Upgrade is not sufficient if the version is the same since apt skips the installation.
100105
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install \
101106
--reinstall libibverbs-dev rdma-core ibverbs-utils libibumad-dev \
102-
libnuma-dev librdmacm-dev ibverbs-providers
107+
libnuma-dev librdmacm-dev ibverbs-providers && \
108+
apt-get clean && \
109+
rm -rf /var/lib/apt/lists/*
103110

104111
WORKDIR /workspace
105112
RUN git clone --depth 1 https://github.com/etcd-cpp-apiv3/etcd-cpp-apiv3.git && \
106113
cd etcd-cpp-apiv3 && \
107114
sed -i '/^find_dependency(cpprestsdk)$/d' etcd-cpp-api-config.in.cmake && \
108115
mkdir build && cd build && \
109-
cmake .. -DBUILD_ETCD_CORE_ONLY=ON -DCMAKE_BUILD_TYPE=Release && make -j${NPROC:-$(nproc)} && make install
116+
cmake .. -DBUILD_ETCD_CORE_ONLY=ON -DCMAKE_BUILD_TYPE=Release && make -j${NPROC:-$(nproc)} && make install && \
117+
cd /workspace && rm -rf etcd-cpp-apiv3
110118

111119
RUN git clone --recurse-submodules --depth 1 --shallow-submodules https://github.com/aws/aws-sdk-cpp.git --branch 1.11.581 && \
112120
mkdir aws_sdk_build && cd aws_sdk_build && \
113121
cmake ../aws-sdk-cpp/ -DCMAKE_BUILD_TYPE=Release -DBUILD_ONLY="s3" -DENABLE_TESTING=OFF -DCMAKE_INSTALL_PREFIX=/usr/local && \
114-
make -j${NPROC:-$(nproc)} && make install
122+
make -j${NPROC:-$(nproc)} && make install && \
123+
cd /workspace && rm -rf aws-sdk-cpp aws_sdk_build
115124

116-
RUN git clone https://github.com/nvidia/gusli.git && \
125+
RUN git clone --depth 1 https://github.com/nvidia/gusli.git && \
117126
cd gusli && \
118127
make all BUILD_RELEASE=1 BUILD_FOR_UNITEST=0 VERBOSE=1 ALLOW_USE_URING=0 && \
119-
cd ..
128+
cd .. && \
129+
rm -rf gusli
120130

121131
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
122132

@@ -159,16 +169,19 @@ RUN cd /usr/local/src && \
159169
--enable-mt && \
160170
make -j${NPROC:-$(nproc)} && \
161171
make -j${NPROC:-$(nproc)} install-strip && \
162-
ldconfig
172+
ldconfig && \
173+
cd /usr/local/src && rm -rf ucx
163174

164175
RUN cd /tmp && \
165176
git clone --depth 1 https://github.com/google/gtest-parallel.git && \
166177
mkdir -p /usr/local/bin && \
167-
cp gtest-parallel/gtest-parallel gtest-parallel/gtest_parallel.py /usr/local/bin/
178+
cp gtest-parallel/gtest-parallel gtest-parallel/gtest_parallel.py /usr/local/bin/ && \
179+
rm -rf gtest-parallel
168180
ENV PATH=/usr/local/bin:$PATH
169181

170182
# Build libfabric from source
171-
RUN wget --tries=3 --waitretry=5 --timeout=30 --read-timeout=60 \
183+
RUN cd /tmp && \
184+
wget --tries=3 --waitretry=5 --timeout=30 --read-timeout=60 \
172185
"https://github.com/ofiwg/libfabric/releases/download/${LIBFABRIC_VERSION}/libfabric-${LIBFABRIC_VERSION#v}.tar.bz2" -O libfabric.tar.bz2 && \
173186
tar xjf libfabric.tar.bz2 && rm libfabric.tar.bz2 && \
174187
cd libfabric-* && \
@@ -186,7 +199,8 @@ RUN wget --tries=3 --waitretry=5 --timeout=30 --read-timeout=60 \
186199
--enable-gdrcopy-dlopen && \
187200
make -j${NPROC:-$(nproc)} && \
188201
make install && \
189-
ldconfig
202+
ldconfig && \
203+
cd /tmp && rm -rf libfabric-*
190204

191205
# Stage 2: Build NIXL (default stage)
192206
FROM nixl-base

0 commit comments

Comments
 (0)