Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker reduce layer size #84

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 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="11"
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
gcc-${GCC_VER} g++-${GCC_VER} gdb \
&& 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 @@ -50,7 +52,8 @@ RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - 2>/dev/
apt-get update -qq && export DEBIAN_FRONTEND=noninteractive && \
apt-get install -y --no-install-recommends \
clang-${LLVM_VER} lldb-${LLVM_VER} lld-${LLVM_VER} clangd-${LLVM_VER} \
llvm-${LLVM_VER}-dev libclang-${LLVM_VER}-dev clang-tidy-${LLVM_VER}
llvm-${LLVM_VER}-dev libclang-${LLVM_VER}-dev clang-tidy-${LLVM_VER} \
&& 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 @@ -66,17 +69,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 @@ -100,9 +106,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
Expand Down