From 99c96d2395566d0b190bf50a2fdeacad7247db5b Mon Sep 17 00:00:00 2001 From: Jakub Panek Date: Sat, 16 Jul 2022 23:26:58 +0000 Subject: [PATCH] feat: add devcontainer --- .devcontainer/.gitconfig | 12 ++++++++ .devcontainer/Dockerfile | 21 ++++++++++++++ .devcontainer/devcontainer.json | 51 +++++++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+) create mode 100644 .devcontainer/.gitconfig create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/.gitconfig b/.devcontainer/.gitconfig new file mode 100644 index 00000000..5ad4a155 --- /dev/null +++ b/.devcontainer/.gitconfig @@ -0,0 +1,12 @@ +[core] + editor = code --wait + +[diff] + tool = vscode +[difftool "vscode"] + cmd = code --wait --diff $LOCAL $REMOTE + +[merge] + tool = vscode +[mergetool "vscode"] + cmd = code --wait $MERGED diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 00000000..bb200528 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,21 @@ +ARG VARIANT="edge" +FROM alpine:${VARIANT} + +ARG UID="1000" +ARG USER="lapce" +RUN adduser -D ${USER} -u ${UID} && \ + addgroup ${USER} wheel + +RUN apk add --no-cache doas cargo rust-src freetype-dev \ + gtk+3.0-dev libgit2-dev libssh2-dev libxcb-dev \ + libxfixes-dev libxkbcommon-dev openssl-dev python3 \ + vulkan-loader-dev wayland-dev curl wget alpine-sdk \ + zsh fish bash less coreutils util-linux + +RUN echo "permit nopass :wheel" > /etc/doas.d/doas.conf + +ENV OPENSSL_NO_VENDOR=1 + +USER ${USER} +SHELL ["bash"] +COPY .gitconfig /home/${USER}/.gitconfig \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..4c210fb4 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,51 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.238.1/containers/alpine +{ + "name": "Alpine", + "build": { + "dockerfile": "Dockerfile", + // Update 'VARIANT' to pick an Alpine version: 3.13, 3.14, 3.15 (MS lags behind with OS versions, 3.16 is available for few months now) + "args": { "VARIANT": "edge" } + }, + + "containerEnv": { + // static linking + // "LIBGIT2_STATIC": "1", + // "LIBSSH2_STATIC": "1", + // "LIBZ_SYS_STATIC": "1", + // "OPENSSL_STATIC": "1", + // "PKG_CONFIG_ALL_STATIC": "1" + }, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "uname -a", + + // Replace when using a ptrace-based debugger like C++, Go, and Rust + "runArgs": [ + "--init", + "--cap-add=SYS_PTRACE", + "--security-opt", + "seccomp=unconfined" + ], + + "extensions": [ + "EditorConfig.EditorConfig", + "esbenp.prettier-vscode", + "redhat.vscode-yaml", + "ms-azuretools.vscode-docker", + "usernamehw.errorlens", + "mhutchie.git-graph", + "oderwat.indent-rainbow", + "ms-vscode.makefile-tools", + "DavidAnson.vscode-markdownlint", + "Swellaby.rust-pack", + "eamodio.gitlens", + "Zerotaskx.rust-extension-pack" + ], + + // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. + "remoteUser": "lapce" +}