59 lines
2.3 KiB
Docker
59 lines
2.3 KiB
Docker
# ubunutu is the base image
|
|
FROM ubuntu:20.04 as cpp-builder
|
|
LABEL version="1.0"
|
|
LABEL author="IRBorisov iborisov@acconcept.ru"
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
# ENV TZ=Europe/Moscow
|
|
# RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
|
|
|
# Install standard packages
|
|
RUN apt-get update -qq && \
|
|
apt-get install -y --no-install-recommends \
|
|
wget \
|
|
git \
|
|
software-properties-common \
|
|
build-essential \
|
|
gpg-agent \
|
|
cmake \
|
|
python3 \
|
|
python3-pip \
|
|
cppcheck
|
|
|
|
# Install conan
|
|
RUN python3 -m pip install --upgrade pip setuptools && \
|
|
python3 -m pip install conan && \
|
|
conan --version
|
|
|
|
# Set compiler versions as arguments
|
|
ARG GCC_VER="11"
|
|
ARG LLVM_VER="14"
|
|
|
|
# Add GCC compiler
|
|
RUN add-apt-repository -y ppa:ubuntu-toolchain-r/test && \
|
|
apt-get update -qq && \
|
|
apt-get install -y --no-install-recommends gcc-${GCC_VER} g++-${GCC_VER} && \
|
|
update-alternatives --install /usr/bin/gcc gcc $(which gcc-${GCC_VER}) 100 && \
|
|
update-alternatives --install /usr/bin/g++ g++ $(which g++-${GCC_VER}) 100
|
|
|
|
# Add Clang compiler
|
|
RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - 2>/dev/null
|
|
RUN add-apt-repository -y "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-${LLVM_VER} main" && \
|
|
apt-get update -qq && \
|
|
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} && \
|
|
update-alternatives --install /usr/bin/clang clang $(which clang-${LLVM_VER}) 100 && \
|
|
update-alternatives --install /usr/bin/clang++ clang++ $(which clang++-${LLVM_VER}) 100 && \
|
|
update-alternatives --install /usr/bin/clang-tidy clang-tidy $(which clang-tidy-${LLVM_VER}) 1
|
|
|
|
# Add current cmake/ccmake, from Kitware
|
|
RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null \
|
|
| gpg --dearmor - | tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null && \
|
|
apt-add-repository 'deb https://apt.kitware.com/ubuntu/ focal main' && \
|
|
apt-get update -qq && \
|
|
apt-get install -y --no-install-recommends cmake cmake-curses-gui
|
|
|
|
# Cleanup cached apt data we don't need anymore
|
|
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
|