feat(docker): update Dockerfile to install Clang 12 and set it as default
This commit is contained in:
parent
94085917ab
commit
878fe4790a
@ -7,10 +7,29 @@ ENV DEBIAN_FRONTEND=noninteractive
|
|||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y \
|
||||||
# Build essentials
|
# Build essentials
|
||||||
build-essential \
|
build-essential \
|
||||||
# Standard clang tools (this will install the default version)
|
# Add LLVM repository for specific Clang versions
|
||||||
clang \
|
wget \
|
||||||
clang-format \
|
lsb-release \
|
||||||
clang-tidy \
|
software-properties-common \
|
||||||
|
gnupg \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Install development tools - Ubuntu 22.04 approach
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
# Build essentials
|
||||||
|
build-essential \
|
||||||
|
# Check what Clang versions are available and install Clang 12 if possible
|
||||||
|
software-properties-common \
|
||||||
|
wget \
|
||||||
|
gnupg \
|
||||||
|
&& apt-get update && \
|
||||||
|
# Install available Clang tools (Ubuntu 22.04 has clang-12 available)
|
||||||
|
apt-get install -y \
|
||||||
|
clang-12 \
|
||||||
|
clang++-12 \
|
||||||
|
clang-format-12 \
|
||||||
|
clang-tidy-12 \
|
||||||
|
# clangd and lldb may have different versioning
|
||||||
clangd \
|
clangd \
|
||||||
lldb \
|
lldb \
|
||||||
# Build tools
|
# Build tools
|
||||||
@ -20,7 +39,6 @@ RUN apt-get update && apt-get install -y \
|
|||||||
pkg-config \
|
pkg-config \
|
||||||
# Version control and utilities
|
# Version control and utilities
|
||||||
git \
|
git \
|
||||||
wget \
|
|
||||||
curl \
|
curl \
|
||||||
unzip \
|
unzip \
|
||||||
# Development utilities
|
# Development utilities
|
||||||
@ -33,9 +51,17 @@ RUN apt-get update && apt-get install -y \
|
|||||||
# Text processing
|
# Text processing
|
||||||
vim \
|
vim \
|
||||||
nano \
|
nano \
|
||||||
|
# Include What You Use
|
||||||
|
iwyu \
|
||||||
# Clean up
|
# Clean up
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Create symbolic links to make clang-12 the default
|
||||||
|
RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-12 100 \
|
||||||
|
&& update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-12 100 \
|
||||||
|
&& update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-12 100 \
|
||||||
|
&& update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-12 100
|
||||||
|
|
||||||
# Create a non-root user for development
|
# Create a non-root user for development
|
||||||
RUN groupadd --gid 1000 vscode \
|
RUN groupadd --gid 1000 vscode \
|
||||||
&& useradd --uid 1000 --gid vscode --shell /bin/bash --create-home vscode \
|
&& useradd --uid 1000 --gid vscode --shell /bin/bash --create-home vscode \
|
||||||
@ -45,9 +71,9 @@ RUN groupadd --gid 1000 vscode \
|
|||||||
&& chmod 0440 /etc/sudoers.d/vscode \
|
&& chmod 0440 /etc/sudoers.d/vscode \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Set clang as the default compiler
|
# Set clang-12 as the default compiler
|
||||||
ENV CC=clang
|
ENV CC=clang-12
|
||||||
ENV CXX=clang++
|
ENV CXX=clang++-12
|
||||||
|
|
||||||
# Set working directory
|
# Set working directory
|
||||||
WORKDIR /workspace
|
WORKDIR /workspace
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user