feat: ultimate dev container

This commit is contained in:
2025-03-22 15:18:26 +01:00
parent 81c509081f
commit 1f63f81979
6 changed files with 206 additions and 0 deletions

55
.devcontainer/Dockerfile Normal file
View File

@ -0,0 +1,55 @@
FROM ubuntu:noble
# Official workaround for "groupadd: GID '1000' already exists"
RUN userdel -r ubuntu
# Set non-interactive mode for apt-get
ENV DEBIAN_FRONTEND=noninteractive
# Install basic dependencies for compilation
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
gcc \
gcc-multilib \
g++-multilib \
make \
wget \
unzip \
git \
gdb \
libc6-dbg \
valgrind \
strace \
clang-format \
python3 python3-pip python3-venv \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Create a virtual environment and install colour-valgrind
RUN python3 -m venv /opt/venv && \
/opt/venv/bin/pip install colour-valgrind
# Add the virtual environment to PATH for all users
ENV PATH="/opt/venv/bin:$PATH"
# Download and install Premake5
RUN wget https://github.com/premake/premake-core/releases/download/v5.0.0-beta5/premake-5.0.0-beta5-linux.tar.gz \
&& tar -xvf premake-5.0.0-beta5-linux.tar.gz \
&& mv premake5 /usr/local/bin/ \
&& chmod +x /usr/local/bin/premake5 \
&& rm premake-5.0.0-beta5-linux.tar.gz
ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID
# Create the user
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
#
# [Optional] Add sudo support. Omit if you don't need to install software after connecting.
&& apt-get update \
&& apt-get install -y sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME
USER $USERNAME

View File

@ -0,0 +1,32 @@
{
"name": "MonitorRam Dev Container",
"build": {
"context": "..",
"dockerfile": "./Dockerfile"
},
"capAdd": [
"SYS_PTRACE"
],
"securityOpt": [
"seccomp=unconfined"
],
"customizations": {
"vscode": {
"extensions": [
"ms-vscode.cpptools-extension-pack"
],
"settings": {
"C_Cpp.clang_format_style": "file",
"C_Cpp.formatting": "clangFormat",
"editor.formatOnSave": true
}
}
},
"runArgs": [
"--network=host"
],
"forwardPorts": [
3000
],
"remoteUser": "vscode"
}