diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 00000000000..3caf5c0a1c8 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,59 @@ +ARG PYTHON_VERSION="3.10" +FROM python:${PYTHON_VERSION}-slim + +RUN apt-get update \ + && apt-get upgrade -y \ + && apt-get install -y --no-install-recommends \ + ca-certificates \ + coreutils \ + curl \ + dialog \ + dirmngr \ + gcc \ + git \ + gnupg2 \ + iproute2 \ + libssl1.1 \ + libxml2-dev \ + libxslt-dev \ + openssh-client \ + procps \ + psmisc \ + rsync \ + sudo \ + unzip \ + wget \ + zip \ + zlib1g \ + libz-dev \ + && rm -rf /var/lib/apt/lists/* + +# Install common python tools for development +RUN pip install \ + autopep8 \ + black \ + flake8 \ + mypy \ + poetry \ + pre-commit \ + pylint + +ARG USERNAME=vscode +ARG USER_ID=1000 +ARG USER_GID=$USER_ID + +# Run with non privileged user +RUN groupadd --gid $USER_GID $USERNAME \ + && useradd \ + --uid $USER_ID \ + --gid $USER_GID \ + --shell /bin/bash \ + --create-home $USERNAME + +# sudo support +RUN echo "$USERNAME ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/$USERNAME \ + && chmod 0440 /etc/sudoers.d/$USERNAME + +ENV CONFIGURE_SUPPORTED_PYTHON=${PYTHON_VERSION} + +USER $USERNAME diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000000..4eeb5717464 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,31 @@ +// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.112.0/containers/python-3 +{ + "name": "ScanCode-Toolkit", + "build": { + "dockerfile": "Dockerfile", + }, + "settings": { + "puppet.installType": "pdk", + "python.pythonPath": "/usr/local/bin/python", + "python.languageServer": "Pylance", + "python.linting.enabled": true, + "python.formatting.provider": "black", + "python.unitTest.pyTestEnabled": true, + "editor.formatOnSave": true, + }, + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "ms-python.python", + "ms-python.vscode-pylance", + "shardulm94.trailing-spaces", + "formulahendry.code-runner", + "aaron-bond.better-comments", + "eamodio.gitlens", + "wholroyd.jinja", + // "xdebug.php-pack", + // "puppet.puppet-vscode", + ], + // "postCreateCommand": "./configure --dev", + "postStartCommand": "pip install -r requirements.txt -r requirements-dev.txt" +}