From c73c190c7b21de01b704b6f2abe925812e1b9b93 Mon Sep 17 00:00:00 2001
From: Martin Stump <martin.stump@mercedes-benz.com>
Date: Wed, 22 Mar 2023 13:28:57 +0100
Subject: [PATCH] Add devcontainer

Signed-off-by: Martin Stump <martin.stump@mercedes-benz.com>
---
 .devcontainer/Dockerfile        | 14 +++++++++
 .devcontainer/devcontainer.json | 50 +++++++++++++++++++++++++++++++++
 2 files changed, 64 insertions(+)
 create mode 100644 .devcontainer/Dockerfile
 create mode 100644 .devcontainer/devcontainer.json

diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile
new file mode 100644
index 0000000..3a1454d
--- /dev/null
+++ b/.devcontainer/Dockerfile
@@ -0,0 +1,14 @@
+FROM mcr.microsoft.com/devcontainers/cpp:0-ubuntu-20.04
+
+RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
+    && apt-get -y install --no-install-recommends \
+    ccache \
+    clang-format \
+    clang-tidy \
+    curl \
+    doxygen \
+    graphviz \
+    libgtest-dev \
+    python3-pip
+
+RUN pip --no-cache-dir install cmakelang
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
new file mode 100644
index 0000000..cfa23be
--- /dev/null
+++ b/.devcontainer/devcontainer.json
@@ -0,0 +1,50 @@
+{
+	"name": "Yase",
+	"build": {
+		"dockerfile": "Dockerfile",
+		"args": {
+			// NOTE temp workaround for docker v23, see https://github.com/microsoft/vscode-remote-release/issues/7958
+			"BUILDKIT_INLINE_CACHE": "0"
+		}
+	},
+	"capAdd": [
+		"SYS_PTRACE"
+	],
+	"securityOpt": [
+		"seccomp=unconfined"
+	],
+	"features": {
+		"ghcr.io/balazs23/devcontainers-features/bazel:1": {}
+	},
+	"customizations": {
+		"vscode": {
+			"extensions": [
+				"cheshirekow.cmake-format",
+				"ms-vscode.cmake-tools",
+				"ms-vscode.cpptools",
+				"ms-vscode.live-server",
+				"redhat.vscode-yaml"
+			],
+			"settings": {
+				"C_Cpp.codeAnalysis.clangTidy.enabled": true,
+				"C_Cpp.default.compileCommands": "${workspaceFolder}/build/compile_commands.json",
+				"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools",
+				"cmake.exportCompileCommandsFile": true,
+				"cmake.generator": "Ninja",
+				"cmake.installPrefix": "${workspaceFolder}/build/prefix",
+				"editor.formatOnSave": true,
+				"editor.tabSize": 2,
+				"files.associations": {
+					".clang-format": "yaml",
+					".clang-tidy": "yaml",
+					".clangd": "yaml",
+					".cmake-format": "yaml",
+					"*.cmake.in": "cmake"
+				},
+				"files.insertFinalNewline": true,
+				"files.trimFinalNewlines": true,
+				"files.trimTrailingWhitespace": true
+			}
+		}
+	}
+}
-- 
GitLab