Skip to content

Commit b194f0d

Browse files
authored
Fix codespaces container creation (Azure#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`
1 parent ace0b79 commit b194f0d

File tree

2 files changed

+47
-65
lines changed

2 files changed

+47
-65
lines changed

.devcontainer/Dockerfile

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,4 @@
22

33
FROM mcr.microsoft.com/vscode/devcontainers/universal:0-linux
44

5-
USER root
6-
7-
# [Option] Install Docker CLI
8-
ARG INSTALL_DOCKER="false"
9-
COPY library-scripts/docker-debian.sh /tmp/library-scripts/
10-
RUN if [ "${INSTALL_DOCKER}" = "true" ]; then \
11-
rm -f /usr/local/share/docker-init.sh \
12-
&& bash /tmp/library-scripts/docker-debian.sh "true" "/var/run/docker-host.sock" "/var/run/docker.sock" "codespace"; \
13-
fi \
14-
&& rm -rf /var/lib/apt/lists/* /tmp/library-scripts/
15-
16-
USER codespace
17-
18-
# ** [Optional] Uncomment this section to install additional packages. **
19-
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
20-
# && apt-get -y install --no-install-recommends <your-package-list-here>
21-
5+
RUN npm install -g "@microsoft/rush"

.devcontainer/devcontainer.json

Lines changed: 46 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,50 @@
11
{
2-
"name": "GitHub Codespaces (Default)",
3-
"build": {
4-
"dockerfile": "Dockerfile",
5-
"args": {
6-
"INSTALL_DOCKER": "true"
7-
}
8-
},
9-
"settings": {
10-
"terminal.integrated.shell.linux": "/bin/bash",
11-
"go.useGoProxyToCheckForToolUpdates": false,
12-
"go.useLanguageServer": true,
13-
"go.gopath": "/go",
14-
"go.goroot": "/usr/local/go",
15-
"go.toolsGopath": "/go/bin",
16-
"python.pythonPath": "/opt/python/latest/bin/python",
17-
"python.linting.enabled": true,
18-
"python.linting.pylintEnabled": true,
19-
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
20-
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
21-
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
22-
"python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
23-
"python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
24-
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
25-
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
26-
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
27-
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint",
28-
"lldb.executable": "/usr/bin/lldb",
29-
"files.watcherExclude": {
30-
"**/target/**": true
31-
}
32-
},
33-
"remoteUser": "codespace",
34-
"overrideCommand": false,
35-
"workspaceMount": "source=${localWorkspaceFolder},target=/home/codespace/workspace,type=bind,consistency=cached",
36-
"workspaceFolder": "/home/codespace/workspace",
37-
"mounts": [ "source=/var/run/docker.sock,target=/var/run/docker-host.sock,type=bind" ],
38-
"runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],
2+
"name": "GitHub Codespaces (Default)",
3+
"build": {
4+
"dockerfile": "Dockerfile",
5+
"args": {
6+
"INSTALL_DOCKER": "true"
7+
}
8+
},
9+
"settings": {
10+
"terminal.integrated.shell.linux": "/bin/bash",
11+
"go.useGoProxyToCheckForToolUpdates": false,
12+
"go.useLanguageServer": true,
13+
"go.gopath": "/go",
14+
"go.goroot": "/usr/local/go",
15+
"go.toolsGopath": "/go/bin",
16+
"python.pythonPath": "/opt/python/latest/bin/python",
17+
"python.linting.enabled": true,
18+
"python.linting.pylintEnabled": true,
19+
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
20+
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
21+
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
22+
"python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
23+
"python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
24+
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
25+
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
26+
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
27+
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint",
28+
"lldb.executable": "/usr/bin/lldb",
29+
"files.watcherExclude": {
30+
"**/target/**": true
31+
}
32+
},
33+
"remoteUser": "codespace",
34+
"overrideCommand": false,
35+
"workspaceMount": "source=${localWorkspaceFolder},target=/home/codespace/workspace,type=bind,consistency=cached",
36+
"workspaceFolder": "/home/codespace/workspace",
37+
"mounts": ["source=/var/run/docker.sock,target=/var/run/docker-host.sock,type=bind"],
38+
"runArgs": ["--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined"],
3939

40-
// Add the IDs of extensions you want installed when the container is created.
41-
"extensions": [
42-
"GitHub.vscode-pull-request-github",
43-
"MS-vsliveshare.vsliveshare",
44-
"VisualStudioExptTeam.vscodeintellicode"
45-
]
40+
// Add the IDs of extensions you want installed when the container is created.
41+
"extensions": [
42+
"GitHub.vscode-pull-request-github",
43+
"MS-vsliveshare.vsliveshare",
44+
"VisualStudioExptTeam.vscodeintellicode"
45+
],
46+
"postCreateCommand": "echo 'skipping Oryx'" // Disable Oryx build which runs npm install and creates a phantom node_modules folder
4647

47-
// Use 'forwardPorts' to make a list of ports inside the container available locally.
48-
// "forwardPorts": [],
49-
50-
// Use 'postCreateCommand' to run commands after the container is created.
51-
// "postCreateCommand": "uname -a"
48+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
49+
// "forwardPorts": [],
5250
}

0 commit comments

Comments
 (0)