From b194f0d59ceed8d6e491f45e5981e35496fca621 Mon Sep 17 00:00:00 2001 From: Maor Leger Date: Fri, 22 Jan 2021 08:52:15 -0800 Subject: [PATCH] Fix codespaces container creation (#13338) The base image now contains the same logic for installing Docker, so by the time our custom file ran Docker was already installed which causes Codespaces creation to error. This commit does a few things: 1. It restores our ability to use codespaces for development 2. It installs rush globally 3. It disables Oryx's default behavior for node since it conflicts with `rush` --- .devcontainer/Dockerfile | 18 +------ .devcontainer/devcontainer.json | 94 ++++++++++++++++----------------- 2 files changed, 47 insertions(+), 65 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 9628a309e34..c33888821ef 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -2,20 +2,4 @@ FROM mcr.microsoft.com/vscode/devcontainers/universal:0-linux -USER root - -# [Option] Install Docker CLI -ARG INSTALL_DOCKER="false" -COPY library-scripts/docker-debian.sh /tmp/library-scripts/ -RUN if [ "${INSTALL_DOCKER}" = "true" ]; then \ - rm -f /usr/local/share/docker-init.sh \ - && bash /tmp/library-scripts/docker-debian.sh "true" "/var/run/docker-host.sock" "/var/run/docker.sock" "codespace"; \ - fi \ - && rm -rf /var/lib/apt/lists/* /tmp/library-scripts/ - -USER codespace - -# ** [Optional] Uncomment this section to install additional packages. ** -# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ -# && apt-get -y install --no-install-recommends - +RUN npm install -g "@microsoft/rush" diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 80712a781c1..6f4bd6e2664 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,52 +1,50 @@ { - "name": "GitHub Codespaces (Default)", - "build": { - "dockerfile": "Dockerfile", - "args": { - "INSTALL_DOCKER": "true" - } - }, - "settings": { - "terminal.integrated.shell.linux": "/bin/bash", - "go.useGoProxyToCheckForToolUpdates": false, - "go.useLanguageServer": true, - "go.gopath": "/go", - "go.goroot": "/usr/local/go", - "go.toolsGopath": "/go/bin", - "python.pythonPath": "/opt/python/latest/bin/python", - "python.linting.enabled": true, - "python.linting.pylintEnabled": true, - "python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8", - "python.formatting.blackPath": "/usr/local/py-utils/bin/black", - "python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf", - "python.linting.banditPath": "/usr/local/py-utils/bin/bandit", - "python.linting.flake8Path": "/usr/local/py-utils/bin/flake8", - "python.linting.mypyPath": "/usr/local/py-utils/bin/mypy", - "python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle", - "python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle", - "python.linting.pylintPath": "/usr/local/py-utils/bin/pylint", - "lldb.executable": "/usr/bin/lldb", - "files.watcherExclude": { - "**/target/**": true - } - }, - "remoteUser": "codespace", - "overrideCommand": false, - "workspaceMount": "source=${localWorkspaceFolder},target=/home/codespace/workspace,type=bind,consistency=cached", - "workspaceFolder": "/home/codespace/workspace", - "mounts": [ "source=/var/run/docker.sock,target=/var/run/docker-host.sock,type=bind" ], - "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ], + "name": "GitHub Codespaces (Default)", + "build": { + "dockerfile": "Dockerfile", + "args": { + "INSTALL_DOCKER": "true" + } + }, + "settings": { + "terminal.integrated.shell.linux": "/bin/bash", + "go.useGoProxyToCheckForToolUpdates": false, + "go.useLanguageServer": true, + "go.gopath": "/go", + "go.goroot": "/usr/local/go", + "go.toolsGopath": "/go/bin", + "python.pythonPath": "/opt/python/latest/bin/python", + "python.linting.enabled": true, + "python.linting.pylintEnabled": true, + "python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8", + "python.formatting.blackPath": "/usr/local/py-utils/bin/black", + "python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf", + "python.linting.banditPath": "/usr/local/py-utils/bin/bandit", + "python.linting.flake8Path": "/usr/local/py-utils/bin/flake8", + "python.linting.mypyPath": "/usr/local/py-utils/bin/mypy", + "python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle", + "python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle", + "python.linting.pylintPath": "/usr/local/py-utils/bin/pylint", + "lldb.executable": "/usr/bin/lldb", + "files.watcherExclude": { + "**/target/**": true + } + }, + "remoteUser": "codespace", + "overrideCommand": false, + "workspaceMount": "source=${localWorkspaceFolder},target=/home/codespace/workspace,type=bind,consistency=cached", + "workspaceFolder": "/home/codespace/workspace", + "mounts": ["source=/var/run/docker.sock,target=/var/run/docker-host.sock,type=bind"], + "runArgs": ["--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined"], - // Add the IDs of extensions you want installed when the container is created. - "extensions": [ - "GitHub.vscode-pull-request-github", - "MS-vsliveshare.vsliveshare", - "VisualStudioExptTeam.vscodeintellicode" - ] + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "GitHub.vscode-pull-request-github", + "MS-vsliveshare.vsliveshare", + "VisualStudioExptTeam.vscodeintellicode" + ], + "postCreateCommand": "echo 'skipping Oryx'" // Disable Oryx build which runs npm install and creates a phantom node_modules folder - // Use 'forwardPorts' to make a list of ports inside the container available locally. - // "forwardPorts": [], - - // Use 'postCreateCommand' to run commands after the container is created. - // "postCreateCommand": "uname -a" + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], }