1
0
Fork 0
mirror of https://github.com/TheLartians/ModernCppStarter.git synced 2025-08-30 13:41:13 +02:00

Docker and devcontainer files for development in an ubuntu container

This commit is contained in:
RS 2025-08-12 08:23:23 +00:00
parent 12cf5de1a8
commit 48bb57b6a5
3 changed files with 53 additions and 0 deletions

View file

@ -0,0 +1,19 @@
// .devcontainer/devcontainer.json
{
"name": "ModernCppStarter",
"context": "..",
"dockerFile": "../Dockerfile",
"customizations": {
"vscode": {
"settings": {
"C_Cpp.default.compilerPath": "/usr/bin/clang++",
"cmake.generator": "Ninja"
},
"extensions": [
"ms-vscode.cmake-tools",
"ms-vscode.cpptools",
"twxs.cmake"
]
}
}
}

30
Dockerfile Normal file
View file

@ -0,0 +1,30 @@
# Use official Ubuntu image
FROM ubuntu:22.04
# Install dependencies
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
build-essential \
cmake \
ninja-build \
git \
curl \
gdb \
lldb \
python3 \
python3-pip \
python3-jinja2 \
clang \
clang-tidy \
lcov \
doxygen \
meson \
libpsl-dev \
sudo \
pkg-config \
&& apt-get clean
RUN pip3 install clang-format==14.0.6 cmake_format==0.6.11 pyyaml
# Load shell.
CMD ["/bin/bash"]

View file

@ -146,6 +146,10 @@ Additional arguments can be passed to the analyzers by setting the `CLANG_TIDY_A
Ccache can be enabled by configuring with `-DUSE_CCACHE=<ON | OFF>`.
#### Devcontainer
The project includes a dockerfile along with a devcontainer file which allows for development in a docker container. Open the project folder in VS Code and you should be prompted to reopen the project in a container.
## FAQ
> Can I use this for header-only libraries?