From ed438a13b29aed810297b6755d8623b6a93a9900 Mon Sep 17 00:00:00 2001 From: Anthony Kim Date: Wed, 14 Jun 2023 14:29:34 -0700 Subject: [PATCH 1/7] Dockerfile for dev container --- .devcontainer/Dockerfile | 49 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .devcontainer/Dockerfile diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 000000000000..17f9eee1cc3c --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,49 @@ +# This image will serve as a starting point for devcontainer.json. +# Get fedora 37 as the base image. +FROM docker.io/library/fedora:37 + +# Install supported python versions and nodejs. +RUN dnf -y --nodocs install /usr/bin/{python3.7,python3.8,python3.9,python3.10,python3.11,git} nodejs gcc conda && \ + source ~/.bashrc && \ + dnf clean all + + +# RUN dnf module install nodejs:16 +# Install make. +# RUN yum install -y make +# Install pip. +# below without . Check pip is available from python version itself try without +RUN curl -L https://bootstrap.pypa.io/pip/pip.pyz --output pip.pyz +# Install nvm, load nvm, and load nvm bash_completion +# ENV version for node version, nvm version, npm version +ENV NVM_VERSION=0.39.3 +ENV NODE_VERSION=16.17.1 +ENV NPM_VERSION=8.19.3 + +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 + + + + + + +# -------------------Notes--------------------- +# pretend dockerfile has no source code +# everything til git clone. + +# virtual environment here? => if we are downloading other stuff here + +#RUN can run any shell commands. +#set env variable +# when done, save state of everything, +# --------------------------------------------- + + From ea4ebe7ce1c5f771b542752cc0a04197ad09a33f Mon Sep 17 00:00:00 2001 From: Anthony Kim Date: Wed, 14 Jun 2023 22:03:06 +0000 Subject: [PATCH 2/7] remove pip file as deemed unnecessary --- .devcontainer/Dockerfile | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 17f9eee1cc3c..e83762484d98 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -8,18 +8,13 @@ RUN dnf -y --nodocs install /usr/bin/{python3.7,python3.8,python3.9,python3.10,p dnf clean all -# RUN dnf module install nodejs:16 -# Install make. -# RUN yum install -y make -# Install pip. -# below without . Check pip is available from python version itself try without -RUN curl -L https://bootstrap.pypa.io/pip/pip.pyz --output pip.pyz -# Install nvm, load nvm, and load nvm bash_completion + # ENV version for node version, nvm version, npm version ENV NVM_VERSION=0.39.3 ENV NODE_VERSION=16.17.1 ENV NPM_VERSION=8.19.3 +# Install nvm, load nvm, and load nvm bash_completion 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" && \ @@ -32,18 +27,3 @@ ENV DISABLE_TRANSLATIONS=true - - - -# -------------------Notes--------------------- -# pretend dockerfile has no source code -# everything til git clone. - -# virtual environment here? => if we are downloading other stuff here - -#RUN can run any shell commands. -#set env variable -# when done, save state of everything, -# --------------------------------------------- - - From 5e4ed4b6cd5e800a86b2682ee96dc1d900217355 Mon Sep 17 00:00:00 2001 From: Anthony Kim Date: Wed, 21 Jun 2023 11:35:24 -0700 Subject: [PATCH 3/7] Added devcontainer.json and postCreateCommand.sh --- .devcontainer/Dockerfile | 13 +++++-------- .devcontainer/devcontainer.json | 33 +++++++++++++++++++++++++++++++++ scripts/postCreateCommand.sh | 15 +++++++++++++++ 3 files changed, 53 insertions(+), 8 deletions(-) create mode 100644 .devcontainer/devcontainer.json create mode 100644 scripts/postCreateCommand.sh diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index e83762484d98..76b8c8e16fbf 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,20 +1,16 @@ # This image will serve as a starting point for devcontainer.json. # Get fedora 37 as the base image. -FROM docker.io/library/fedora:37 +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} nodejs gcc conda && \ - source ~/.bashrc && \ +RUN dnf -y --nodocs install /usr/bin/{python3.7,python3.8,python3.9,python3.10,python3.11,git} gcc conda && \ dnf clean all - - -# ENV version for node version, nvm version, npm version ENV NVM_VERSION=0.39.3 ENV NODE_VERSION=16.17.1 ENV NPM_VERSION=8.19.3 -# Install nvm, load nvm, and load nvm bash_completion +# 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" && \ @@ -22,8 +18,9 @@ RUN export NVM_DIR="$HOME/.nvm" && \ nvm install $NODE_VERSION && \ npm install -g npm@$NPM_VERSION -# For clean open source builds +# 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..6948b1dc5dc8 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,33 @@ +// 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", + "ms-python.pylint" + ], + "settings": { + // "python.defaultInterpreterPath": "/workspaces/vscode-python/.venv/bin/python" + } + } + }, + // 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..7b68ac75633f --- /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/test-requirements.txt +/workspaces/vscode-python/.venv/bin/python -m pip install -r build/smoke-test-requirements.txt From 4144b441c86f3cb2559f743887f580d5b310e9d5 Mon Sep 17 00:00:00 2001 From: Anthony Kim Date: Wed, 21 Jun 2023 11:38:38 -0700 Subject: [PATCH 4/7] clean up default interpreter setting --- .devcontainer/devcontainer.json | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 6948b1dc5dc8..eb52c826fdaf 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -17,10 +17,7 @@ "ms-python.vscode-pylance", "charliermarsh.ruff", "ms-python.pylint" - ], - "settings": { - // "python.defaultInterpreterPath": "/workspaces/vscode-python/.venv/bin/python" - } + ] } }, // Commands to execute on container creation,start. From 89d8aadd36b06a7895fdfb018dce1223aa722a41 Mon Sep 17 00:00:00 2001 From: Anthony Kim Date: Thu, 22 Jun 2023 13:52:42 -0700 Subject: [PATCH 5/7] fix fedora version, path to conda --- .devcontainer/Dockerfile | 4 ++-- scripts/postCreateCommand.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 76b8c8e16fbf..50e9d6acb58a 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,9 +1,9 @@ # This image will serve as a starting point for devcontainer.json. -# Get fedora 37 as the base image. +# 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} gcc conda && \ +RUN dnf -y --nodocs install /usr/bin/{python3.7,python3.8,python3.9,python3.10,python3.11,git,gcc,conda} && \ dnf clean all ENV NVM_VERSION=0.39.3 diff --git a/scripts/postCreateCommand.sh b/scripts/postCreateCommand.sh index 7b68ac75633f..85462caf7fad 100644 --- a/scripts/postCreateCommand.sh +++ b/scripts/postCreateCommand.sh @@ -11,5 +11,5 @@ 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/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 From ed77a47dfefa941cf38c94d76dd0e24db220b5d1 Mon Sep 17 00:00:00 2001 From: Anthony Kim <62267334+anthonykim1@users.noreply.github.com> Date: Mon, 26 Jun 2023 11:24:45 -0700 Subject: [PATCH 6/7] Update .devcontainer/devcontainer.json Co-authored-by: Karthik Nadig --- .devcontainer/devcontainer.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index eb52c826fdaf..6435ba5bbda8 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -15,8 +15,7 @@ "ms-python.python", "ms-python.black-formatter", "ms-python.vscode-pylance", - "charliermarsh.ruff", - "ms-python.pylint" + "charliermarsh.ruff" ] } }, From 7b50445d6f170d3274435c2152a7bc45d292e351 Mon Sep 17 00:00:00 2001 From: Anthony Kim Date: Mon, 26 Jun 2023 13:08:09 -0700 Subject: [PATCH 7/7] replace gcc with clang --- .devcontainer/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 50e9d6acb58a..f5f49445b399 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -3,7 +3,7 @@ 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,gcc,conda} && \ +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