Skip to content

Commit

Permalink
Merge pull request #8 from janru/docker-reduce-image-size
Browse files Browse the repository at this point in the history
Docker reduce image size
  • Loading branch information
johannes-graeter authored Feb 24, 2024
2 parents 67b2b63 + 41621fa commit fcaab64
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ RUN apt-get update -qq && export DEBIAN_FRONTEND=noninteractive && \
software-properties-common wget apt-utils file zip \
openssh-client gpg-agent socat rsync \
make ninja-build git \
python3 python3-pip
python3 python3-pip \
&& rm -rf /var/lib/apt/lists/*

# Install conan
RUN python3 -m pip install --upgrade pip setuptools && \
python3 -m pip install conan && \
RUN python3 -m pip install --no-cache-dir --upgrade pip setuptools && \
python3 -m pip install --no-cache-dir conan && \
conan --version

# By default, anything you run in Docker is done as superuser.
Expand All @@ -35,7 +36,8 @@ ARG GCC_VER="13"
RUN add-apt-repository -y ppa:ubuntu-toolchain-r/test && \
apt-get update -qq && export DEBIAN_FRONTEND=noninteractive && \
apt-get install -y --no-install-recommends \
gcc-${GCC_VER} g++-${GCC_VER} gdb libstdc++-${GCC_VER}-dev
gcc-${GCC_VER} g++-${GCC_VER} gdb libstdc++-${GCC_VER}-dev \
&& rm -rf /var/lib/apt/lists/*

# Set gcc-${GCC_VER} as default gcc
RUN update-alternatives --install /usr/bin/gcc gcc $(which gcc-${GCC_VER}) 100 \
Expand All @@ -52,7 +54,8 @@ RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - 2>/dev/
clang-${LLVM_VER} llvm-${LLVM_VER}-dev \
lldb-${LLVM_VER} lld-${LLVM_VER} clangd-${LLVM_VER} \
libclang-${LLVM_VER}-dev clang-tidy-${LLVM_VER} clang-format-${LLVM_VER} \
libc++-${LLVM_VER}-dev libc++abi-${LLVM_VER}-dev
libc++-${LLVM_VER}-dev libc++abi-${LLVM_VER}-dev \
&& rm -rf /var/lib/apt/lists/*

# Set the default clang-tidy, so CMake can find it
RUN update-alternatives --install /usr/bin/clang-tidy clang-tidy $(which clang-tidy-${LLVM_VER}) 1 \
Expand All @@ -69,17 +72,20 @@ RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/nul
| gpg --dearmor - | tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null && \
apt-add-repository -y "deb ${CMAKE_URL} ${CMAKE_PKG} main" && \
apt-get update -qq && export DEBIAN_FRONTEND=noninteractive && \
apt-get install -y --no-install-recommends cmake cmake-curses-gui
apt-get install -y --no-install-recommends cmake cmake-curses-gui \
&& rm -rf /var/lib/apt/lists/*

# Install editors
RUN apt-get update -qq && export DEBIAN_FRONTEND=noninteractive && \
apt-get install -y --no-install-recommends \
neovim emacs nano
neovim emacs nano \
&& rm -rf /var/lib/apt/lists/*

# Install optional dependecies
RUN apt-get update -qq && export DEBIAN_FRONTEND=noninteractive && \
apt-get install -y --no-install-recommends \
doxygen graphviz ccache cppcheck
doxygen graphviz ccache cppcheck \
&& rm -rf /var/lib/apt/lists/*

# Install include-what-you-use
ENV IWYU /home/iwyu
Expand All @@ -103,10 +109,6 @@ RUN mkdir -p $(include-what-you-use -print-resource-dir 2>/dev/null)
RUN ln -s $(readlink -f /usr/lib/clang/${LLVM_VER}/include) \
$(include-what-you-use -print-resource-dir 2>/dev/null)/include

# Cleanup cached apt data we don't need anymore
RUN apt-get autoremove -y && apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Allow the user to set compiler defaults
ARG USE_CLANG
# if --build-arg USE_CLANG=1, set CC to 'clang' or set to null otherwise.
Expand Down

0 comments on commit fcaab64

Please sign in to comment.