Skip to content

Commit 740bce1

Browse files
committed
use echo to indicate image layer, switch to curl, cleanups
1 parent 2fbec9e commit 740bce1

File tree

2 files changed

+202
-148
lines changed

2 files changed

+202
-148
lines changed

.devcontainer/debian/bookworm/Dockerfile

+84-57
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
# Debian Bookworm
1919
#
20-
# LLVM: https://packages.debian.org/bookworm/llvm 16.0
20+
# LLVM: https://packages.debian.org/bookworm/llvm 14.0
2121
# GCC: https://packages.debian.org/bookworm/gcc 12.2.0
2222

2323
# +-----------------------------+
@@ -43,15 +43,21 @@ FROM debian:bookworm-slim AS downloader
4343
# Reuse global arguments
4444
ARG VULKAN_VERSION
4545

46-
ENV DEBIAN_FRONTEND=noninteractive
47-
46+
ENV DEBIAN_FRONTEND=noninteractive \
47+
CURL_OPTIONS="--progress-bar --location"
4848
#ENV CURL_OPTIONS="--silent --show-error --retry 5 --connect-timeout 20 --max-time 10"
49-
ENV CURL_OPTIONS_BAR="--progress-bar"
5049

5150
WORKDIR /tmp
52-
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates curl && \
53-
curl $CURL_OPTIONS_BAR -o gcc.xz "http://ftp.gnu.org/gnu/gcc/gcc-13.3.0/gcc-13.3.0.tar.xz" && \
54-
curl $CURL_OPTIONS_BAR -o vulkansdk.xz "https://sdk.lunarg.com/sdk/download/${VULKAN_VERSION}/linux/vulkansdk-linux-x86_64-${VULKAN_VERSION}.tar.xz"
51+
RUN echo "Download Stage" && \
52+
apt-get update && apt-get install -y --no-install-recommends ca-certificates curl && \
53+
curl $CURL_OPTIONS -o gcc.xz "http://ftp.gnu.org/gnu/gcc/gcc-13.3.0/gcc-13.3.0.tar.xz" && \
54+
curl $CURL_OPTIONS -o vulkansdk.xz "https://sdk.lunarg.com/sdk/download/${VULKAN_VERSION}/linux/vulkansdk-linux-x86_64-${VULKAN_VERSION}.tar.xz" && \
55+
# Cleanup
56+
apt-get autoremove -y && \
57+
apt-get clean autoclean && \
58+
rm -rf /var/lib/apt/lists/* && \
59+
# List files in /tmp
60+
ls -la /tmp
5561

5662
# +-----------------------------+
5763
# | BASE IMAGE | See https://hub.docker.com/_/debian
@@ -98,14 +104,10 @@ LABEL \
98104
# Y8b d88P
99105
# "Y88P"
100106

101-
# +-----------------------------+
102-
# | PRE-REQUISITE/INIT PACKAGES |
103-
# +-----------------------------+
107+
ENV DEBIAN_FRONTEND=noninteractive \
108+
CURL_OPTIONS="--progress-bar --location"
104109

105-
ENV DEBIAN_FRONTEND=noninteractive
106-
107-
# avoid debconf delaying package configuration, since apt-utils is not installed
108-
RUN apt-get update && apt-get install -y --no-install-recommends apt-utils dialog 2>&1 && \
110+
RUN echo "Packages" && \
109111
apt-get update && apt-get install -y --no-install-recommends \
110112
gnupg2 ca-certificates software-properties-common \
111113
build-essential cppcheck valgrind lcov wget git nano jq \
@@ -124,7 +126,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends apt-utils dialo
124126
# optional tools for Doxygen
125127
python3 python3-pip \
126128
python3-sphinx python3-sphinx-rtd-theme python3-defusedxml sphinx-common \
127-
graphviz
129+
graphviz && \
130+
# Cleanup
131+
apt-get autoremove -y && \
132+
apt-get clean autoclean && \
133+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
128134

129135
#
130136
# .d8888b. d8b 888 888 888 .d8888b. 888 8888888
@@ -137,17 +143,19 @@ RUN apt-get update && apt-get install -y --no-install-recommends apt-utils dialo
137143
# "Y8888P88 888 "Y888 888 888 "Y88888 88888P" "Y8888P" 88888888 8888888
138144
#
139145

140-
# +-----------------------------+
141-
# | Github CLI |
142-
# +-----------------------------+
143146
# Website: https://cli.github.com/
144147
# Installation Instructions: https://github.com/cli/cli/blob/trunk/docs/install_linux.md#official-sources
145148

146149
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
147-
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg && \
150+
RUN echo "GITHUB CLI" && \
151+
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg && \
148152
chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg && \
149153
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null && \
150-
apt-get update && apt-get install -y --no-install-recommends gh
154+
apt-get update && apt-get install -y --no-install-recommends gh && \
155+
# Cleanup
156+
apt-get autoremove -y && \
157+
apt-get clean autoclean && \
158+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
151159

152160
#
153161
# .d8888b. 888b d888 888
@@ -160,15 +168,13 @@ RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | d
160168
# "Y8888P" 888 888 "Y888888 888 888 "Y8888
161169
#
162170

163-
# +-----------------------------+
164-
# | CMake - Latest Version |
165-
# +-----------------------------+
166171
# Latest Release: https://github.com/Kitware/CMake/releases/latest
167172

168173
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
169-
RUN version="$(curl -s https://api.github.com/repos/Kitware/CMake/releases/latest | jq -r '.tag_name' | cut -c 2-)"; echo "Latest Version: \"$version\"" && \
174+
RUN echo "CMake" && \
175+
version="$(curl -s https://api.github.com/repos/Kitware/CMake/releases/latest | jq -r '.tag_name' | cut -c 2-)"; echo "Latest Version: \"$version\"" && \
170176
url="https://github.com/Kitware/CMake/releases/download/v$version/cmake-$version-linux-x86_64.sh"; echo "Download URL: \"$url\"" && \
171-
wget -q $url && \
177+
curl $CURL_OPTIONS -O $url && \
172178
mkdir /opt/cmake && \
173179
sh cmake-$version-linux-x86_64.sh --prefix=/opt/cmake --skip-license && \
174180
ln -s /opt/cmake/bin/cmake /usr/bin/cmake && \
@@ -185,9 +191,6 @@ RUN version="$(curl -s https://api.github.com/repos/Kitware/CMake/releases/lates
185191
# Y8P "Y8888P" 888 888 Y88b "Y8888P88
186192
#
187193

188-
# +-----------------------------+
189-
# | vcpkg ~225MB|
190-
# +-----------------------------+
191194
# vcpkg requires curl, unzip, tar, pkg-config (optional cmake).
192195
# We use the installed binaries from the system.
193196
# We do not download latest version of CMake and Ninja during vcpkg bootstrap.
@@ -199,7 +202,8 @@ ENV VCPKG_ROOT=/opt/vcpkg \
199202
ENV PATH="${PATH}:${VCPKG_ROOT}"
200203

201204
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
202-
RUN git clone --depth=1 \
205+
RUN echo "VCPKG" && \
206+
git clone --depth=1 \
203207
-c core.eol=lf \
204208
-c core.autocrlf=false \
205209
-c fsck.zeroPaddedFilemode=ignore \
@@ -219,12 +223,9 @@ RUN git clone --depth=1 \
219223
# "Y8888P" "Y8888P" d88P 888 "Y8888P" 888 888 8888888888
220224
#
221225

222-
# +-----------------------------+
223-
# | ccache - Latest Version |
224-
# +-----------------------------+
225-
226226
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
227-
RUN version="$(curl -s https://api.github.com/repos/ccache/ccache/releases/latest | jq -r '.tag_name' | cut -c 2-)"; echo "Latest Version: \"$version\"" && \
227+
RUN echo "CCACHE" && \
228+
version="$(curl -s https://api.github.com/repos/ccache/ccache/releases/latest | jq -r '.tag_name' | cut -c 2-)"; echo "Latest Version: \"$version\"" && \
228229
url="https://github.com/ccache/ccache/releases/download/v$version/ccache-$version-linux-x86_64.tar.xz"; echo "Download URL: \"$url\"" && \
229230
wget -q $url && \
230231
mkdir -p /opt/ccache/bin &&\
@@ -249,10 +250,11 @@ RUN version="$(curl -s https://api.github.com/repos/ccache/ccache/releases/lates
249250
# We are using the prebuilt binaries for x64.
250251

251252
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
252-
RUN version_string="$(curl -s https://api.github.com/repos/doxygen/doxygen/releases/latest | jq -r '.tag_name')"; echo "Latest Version: \"$version_string\"" && \
253+
RUN echo "DOXYGEN" && \
254+
version_string="$(curl -s https://api.github.com/repos/doxygen/doxygen/releases/latest | jq -r '.tag_name')"; echo "Latest Version: \"$version_string\"" && \
253255
version_number="$(echo $version_string | cut -c 9- | sed 's/_/./g')" && \
254256
url="https://github.com/doxygen/doxygen/releases/download/$version_string/doxygen-$version_number.linux.bin.tar.gz"; echo "Download URL: \"$url\"" && \
255-
wget -q $url && \
257+
curl $CURL_OPTIONS -O $url && \
256258
mkdir /opt/doxygen && \
257259
tar xf doxygen-$version_number.linux.bin.tar.gz --strip-components=1 -C /opt/doxygen && \
258260
ln -s /opt/doxygen/bin/doxygen /usr/bin && \
@@ -276,7 +278,8 @@ RUN version_string="$(curl -s https://api.github.com/repos/doxygen/doxygen/relea
276278
# RUN wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && ./llvm.sh ${LLVM_VERSION} all && rm ./llvm.sh
277279

278280
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
279-
RUN wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc && \
281+
RUN echo "LLVM" && \
282+
curl -s https://apt.llvm.org/llvm-snapshot.gpg.key | tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc && \
280283
add-apt-repository -y "deb http://apt.llvm.org/$DEBIAN_VERSION_NAME/ llvm-toolchain-$DEBIAN_VERSION_NAME-$LLVM_VERSION main" && \
281284
apt-get update && apt-get install -y --no-install-recommends \
282285
clang-$LLVM_VERSION \
@@ -300,9 +303,10 @@ RUN wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | tee /etc/apt/trusted.
300303
libunwind-$LLVM_VERSION-dev \
301304
libclang-rt-$LLVM_VERSION-dev \
302305
libpolly-$LLVM_VERSION-dev && \
303-
apt-get autoremove -y && \
306+
# Cleanup
307+
apt-get autoremove -y && \
304308
apt-get clean autoclean && \
305-
rm -rf /var/lib/apt/lists/*
309+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
306310

307311
# add llvm to path
308312
ENV PATH="/usr/lib/llvm-${LLVM_VERSION}/bin:/usr/lib/llvm-${LLVM_VERSION}/include:${PATH}"
@@ -312,7 +316,8 @@ ENV LD_LIBRARY_PATH="/usr/lib:/usr/local/lib"
312316
ENV LD_LIBRARY_PATH="/usr/lib/llvm-${LLVM_VERSION}/lib:${LD_LIBRARY_PATH:-}"
313317

314318
# unversionize the binaries
315-
RUN ln -s /usr/bin/clang-${LLVM_VERSION} /usr/bin/clang && \
319+
RUN echo "LLVM symlink binaries" && \
320+
ln -s /usr/bin/clang-${LLVM_VERSION} /usr/bin/clang && \
316321
ln -s /usr/bin/clang++-${LLVM_VERSION} /usr/bin/clang++ && \
317322
ln -s /usr/bin/clang-format-${LLVM_VERSION} /usr/bin/clang-format
318323

@@ -321,7 +326,8 @@ ENV CC=/usr/bin/clang \
321326
CXX=/usr/bin/clang++
322327

323328
# update alternatives
324-
RUN update-alternatives --install /usr/bin/cc cc /usr/bin/clang 100 && \
329+
RUN echo "LLVM udate-alternatives" && \
330+
update-alternatives --install /usr/bin/cc cc /usr/bin/clang 100 && \
325331
update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++ 100
326332

327333
#
@@ -335,15 +341,13 @@ RUN update-alternatives --install /usr/bin/cc cc /usr/bin/clang 100 && \
335341
# 888 888 "Y88P" 888 "Y88888
336342
#
337343

338-
# +-----------------------------+
339-
# | Mold Linker ~10MB|
340-
# +-----------------------------+
341344
# We are using Clang++ for compilation, so this download + compile step must happen after installing LLVM+Clang.
342345
# We don't need to call mold's ./install-build-deps.sh, because all build dependencies are present.
343346
# Note to overwrite ld: sudo ln -sf /opt/mold/bin/mold $(realpath /usr/bin/ld)
344347

345348
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
346-
RUN version="$(curl -s https://api.github.com/repos/rui314/mold/releases/latest | jq -r '.tag_name' | cut -c 2-)"; echo "Latest Version: \"$version\"" && \
349+
RUN echo "MOLD" && \
350+
version="$(curl -s https://api.github.com/repos/rui314/mold/releases/latest | jq -r '.tag_name' | cut -c 2-)"; echo "Latest Version: \"$version\"" && \
347351
git clone --depth=1 --branch "v$version" https://github.com/rui314/mold.git "/tmp/mold" && \
348352
cmake -S /tmp/mold -B /tmp/mold/build -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=clang++ && \
349353
cmake --build /tmp/mold/build -j "$(nproc)" && \
@@ -367,7 +371,8 @@ RUN version="$(curl -s https://api.github.com/repos/rui314/mold/releases/latest
367371
# +-----------------------------+
368372

369373
COPY --from=downloader /tmp/gcc.xz /tmp/gcc.xz
370-
RUN tar xf /tmp/gcc.xz && rm /tmp/gcc.xz && \
374+
RUN echo "GCC - Extract" && \
375+
tar xf /tmp/gcc.xz && rm /tmp/gcc.xz && \
371376
apt-get update && apt-get install -y --no-install-recommends \
372377
libmpfr-dev libgmp3-dev libmpc-dev
373378

@@ -383,7 +388,8 @@ WORKDIR /gcc-13.3.0
383388
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
384389

385390
# https://gcc.gnu.org/install/configure.html
386-
RUN ./configure \
391+
RUN echo "GCC - Compile" && \
392+
./configure \
387393
--libdir=/usr/lib \
388394
--libexecdir=/usr/lib \
389395
--prefix=/usr \
@@ -434,8 +440,12 @@ RUN ./configure \
434440
WORKDIR /
435441

436442
# remove gcc source folder and dependencies
437-
RUN rm -rf gcc-13.3.0 && \
438-
apt-get autoremove -y libmpfr-dev libgmp3-dev libmpc-dev
443+
RUN echo "GCC - Cleanup" && \
444+
rm -rf gcc-13.3.0 && \
445+
# Cleanup
446+
apt-get autoremove -y libmpfr-dev libgmp3-dev libmpc-dev && \
447+
apt-get clean autoclean && \
448+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
439449

440450
# reset default compiler to clang
441451
ENV CC=/usr/bin/clang \
@@ -462,23 +472,33 @@ ENV TERM=xterm-256color \
462472
ZSH_THEME=agnoster
463473

464474
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
465-
RUN apt-get update && apt-get install -y --no-install-recommends zsh powerline fonts-powerline && \
466-
curl -fsSL https://install.ohmyz.sh | sh && \
475+
RUN echo "ZSH" && \
476+
apt-get update && apt-get install -y --no-install-recommends zsh powerline fonts-powerline && \
477+
# Install Oh My Zsh
478+
curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh | sh && \
479+
# Add Zsh plugins
467480
git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions && \
468481
git clone --depth=1 https://github.com/zsh-users/zsh-completions ${ZSH_CUSTOM:=~/.oh-my-zsh/custom}/plugins/zsh-completions && \
469482
git clone --depth=1 https://github.com/zsh-users/zsh-history-substring-search ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-history-substring-search && \
483+
# Update .zshrc
470484
sed -i "s/plugins=(git)/plugins=(git zsh-completions zsh-autosuggestions zsh-history-substring-search)/" /root/.zshrc && \
471-
sed -i "s/ZSH_THEME=\"agnoster\"/ZSH_THEME=\"robbyrussell\"/" /root/.zshrc
485+
sed -i "s/ZSH_THEME=\"agnoster\"/ZSH_THEME=\"robbyrussell\"/" /root/.zshrc && \
486+
# Cleanup
487+
apt-get autoremove -y && \
488+
apt-get clean autoclean && \
489+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
472490

491+
# Set the default shell to zsh after it is installed
473492
ENV SHELL=/bin/zsh
474493

475494
# +-----------------------------+
476495
# | CLEANUP |
477496
# +-----------------------------+
478497

479-
RUN apt-get autoremove -y && \
498+
RUN echo "CLeanup" && \
499+
apt-get autoremove -y && \
480500
apt-get clean autoclean && \
481-
rm -rf /var/lib/apt/lists/*
501+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
482502

483503
# +-----------------------------+
484504
# | Set Locale + Timezone |
@@ -487,7 +507,8 @@ RUN apt-get autoremove -y && \
487507
ENV TZ=Europe/Berlin
488508

489509
# configure german locale
490-
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \
510+
RUN echo "Locale & Timezone" && \
511+
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \
491512
echo $TZ > /etc/timezone && \
492513
dpkg-reconfigure tzdata && \
493514
sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
@@ -577,8 +598,14 @@ ENV PATH="$VULKAN_SDK/bin:$PATH" \
577598
# To test CPU rendering using the Mesa Vulkan drivers, you can use "vkcube",
578599
# which is a simple spinning-cube app to demonstrate Vulkan functionality.
579600
#
580-
RUN apt-get update && apt-get install -y --no-install-recommends \
581-
mesa-vulkan-drivers
601+
RUN echo "Mesa" && \
602+
apt-get update && apt-get install -y --no-install-recommends \
603+
libgl1-mesa-dri \
604+
mesa-vulkan-drivers && \
605+
# Cleanup
606+
apt-get autoremove -y && \
607+
apt-get clean autoclean && \
608+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
582609

583610
#
584611
# https://docs.mesa3d.org/envvars.html

0 commit comments

Comments
 (0)