diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 000000000000..f5f49445b399 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,26 @@ +# This image will serve as a starting point for devcontainer.json. +# Get latest image of Fedora as the base image. +FROM docker.io/library/fedora:latest + +# Install supported python versions and nodejs. +RUN dnf -y --nodocs install /usr/bin/{python3.7,python3.8,python3.9,python3.10,python3.11,git,conda,clang} && \ + dnf clean all + +ENV NVM_VERSION=0.39.3 +ENV NODE_VERSION=16.17.1 +ENV NPM_VERSION=8.19.3 + +# Installation instructions from https://github.com/nvm-sh/nvm . +RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v$NVM_VERSION/install.sh | bash +RUN export NVM_DIR="$HOME/.nvm" && \ + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \ + [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" && \ + nvm install $NODE_VERSION && \ + npm install -g npm@$NPM_VERSION + +# For clean open source builds. +ENV DISABLE_TRANSLATIONS=true + + + + diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000000..6435ba5bbda8 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,29 @@ +// For format details, see https://aka.ms/devcontainer.json. +{ + "name": "VS Code Python Dev Container", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "build": { + "dockerfile": "./Dockerfile", + "context": ".." + }, + "customizations": { + "vscode": { + "extensions": [ + "editorconfig.editorconfig", + "esbenp.prettier-vscode", + "dbaeumer.vscode-eslint", + "ms-python.python", + "ms-python.black-formatter", + "ms-python.vscode-pylance", + "charliermarsh.ruff" + ] + } + }, + // Commands to execute on container creation,start. + "postCreateCommand": "bash scripts/postCreateCommand.sh", + // Environment variable placed inside containerEnv following: https://containers.dev/implementors/json_reference/#general-properties + "containerEnv": { + "CI_PYTHON_PATH": "/workspaces/vscode-python/.venv/bin/python" + } + +} diff --git a/scripts/postCreateCommand.sh b/scripts/postCreateCommand.sh new file mode 100644 index 000000000000..85462caf7fad --- /dev/null +++ b/scripts/postCreateCommand.sh @@ -0,0 +1,15 @@ +#!/bin/bash +npm ci +# Create Virutal environment. +python3.7 -m venv /workspaces/vscode-python/.venv + +# Activate Virtual environment. +source /workspaces/vscode-python/.venv/bin/activate + +# Install required Python libraries. +npx gulp installPythonLibs + +# Install testing requirement using python in .venv . +/workspaces/vscode-python/.venv/bin/python -m pip install -r build/test-requirements.txt +/workspaces/vscode-python/.venv/bin/python -m pip install -r build/smoke-test-requirements.txt +/workspaces/vscode-python/.venv/bin/python -m pip install -r build/functional-test-requirements.txt