From 2c42efe1db1f3284c16c5548247a10c03ad7fdfe Mon Sep 17 00:00:00 2001 From: usrbinkat Date: Wed, 29 Jan 2025 21:14:17 +0000 Subject: [PATCH] first successful launch of veilid devcontainer --- .devcontainer/Dockerfile | 33 +++++++++++++++++++++++++++++++++ .devcontainer/devcontainer.json | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 65 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 00000000..1bc73b9c --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,33 @@ +FROM docker.io/library/rust:1.84.0-bullseye + +# Create a non-root user with same UID/GID as host user +ARG USERNAME=vscode +ARG USER_UID=1000 +ARG USER_GID=$USER_UID + +# Install basic tools +RUN apt-get update && apt-get install -y \ + sudo \ + curl \ + git \ + build-essential \ + && rm -rf /var/lib/apt/lists/* + +# Create the user +RUN groupadd --gid $USER_GID $USERNAME \ + && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ + && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ + && chmod 0440 /etc/sudoers.d/$USERNAME + +# Set working directory +WORKDIR /workspaces/veilid + +# Set the default user +USER $USERNAME + +# Expose port +EXPOSE 5150 + +# Set default shell to bash +ENV SHELL="/bin/bash" +CMD ["sleep", "infinity"] \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..0ed2e53f --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,32 @@ +{ + "name": "veilid", + "dockerFile": "Dockerfile", + "overrideCommand": false, + "updateRemoteUserUID": true, + "remoteUser": "vscode", + "securityOpt": [ + "seccomp=unconfined" + ], + "runArgs": [ + "--network=host", + "--cap-add=SYS_PTRACE", + "--security-opt=seccomp=unconfined" + ], + "mounts": [ + "source=/var/run/docker.sock,target=/var/run/docker-host.sock,type=bind" + ], + "features": { + "ghcr.io/devcontainers/features/docker-outside-of-docker:1": {} + }, + "postCreateCommand": "cargo --version", + "shutdownAction": "stopContainer", + "customizations": { + "vscode": { + "settings": { + "terminal.integrated.defaultProfile.linux": "bash" + } + } + }, + "forwardPorts": [5150], + "init": true +} \ No newline at end of file