From 30e705b093c5b86804692b9e881d65e8e6dfb46b Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Tue, 27 Feb 2024 18:28:46 +0800 Subject: [PATCH] Add devcontainer setup --- .devcontainer/Dockerfile | 33 +++++++++++++++++++++++++++++++++ .devcontainer/devcontainer.json | 32 ++++++++++++++++++++++++++++++++ .devcontainer/requirements.txt | 2 ++ 3 files changed, 67 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json create mode 100644 .devcontainer/requirements.txt diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 00000000..2ff9f255 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,33 @@ +FROM ubuntu:latest + +ARG USERNAME=user +ARG USER_UID=1000 +ARG USER_GID=$USER_UID + +RUN apt-get update +RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \ + curl \ + flake8 \ + gh \ + git \ + gnupg2 \ + jq \ + libcap-dev \ + libssl-dev \ + pylint \ + python3 \ + python3-dev \ + python3-flake8 \ + python3-pip \ + python3-pycodestyle \ + sudo \ + zsh + +RUN groupadd --gid $USER_GID $USERNAME \ + && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ + && chsh -s /usr/bin/zsh user \ + && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ + && chmod 0440 /etc/sudoers.d/$USERNAME + +USER $USERNAME +WORKDIR /home/$USERNAME diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..d0659c15 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,32 @@ +{ + "name": "Codespaces Python3", + "extensions": [ + "cschleiden.vscode-github-actions", + "eamodio.gitlens", + "github.vscode-pull-request-github", + "ms-azuretools.vscode-docker", + "ms-python.flake8", + "ms-python.pylint", + "ms-python.python", + "ms-vsliveshare.vsliveshare", + "nwgh.bandit", + "the-compiler.python-tox", + "vscode-icons-team.vscode-icons", + "visualstudioexptteam.vscodeintellicode" + ], + "dockerFile": "Dockerfile", + "onCreateCommand": "pip3 install -r .devcontainer/requirements.txt", + "postCreateCommand": "pip3 install -r requirements.txt", + "settings": { + "flake8.args": ["--config=setup.cfg"], + "pylint.args": ["--rcfile=setup.cfg"], + "terminal.integrated.shell.linux": "/usr/bin/zsh", + "terminal.integrated.defaultProfile.linux": "zsh", + "terminal.integrated.fontFamily": "'SourceCodePro+Powerline+Awesome Regular'", + "terminal.integrated.fontSize": 14, + "files.exclude": { + "**/CODE_OF_CONDUCT.md": true, + "**/LICENSE": true + } + } +} diff --git a/.devcontainer/requirements.txt b/.devcontainer/requirements.txt new file mode 100644 index 00000000..74878b30 --- /dev/null +++ b/.devcontainer/requirements.txt @@ -0,0 +1,2 @@ +tox +virtualenv