Skip to content

Commit e229b5e

Browse files
authored
use devcontainer named volumes (#1505)
Following NomicFoundation/edr#1101 - Disabled `Rust Analyzer` vscode extension. - Ran vscode command `Dev Containers: Rebuild Container Without Cache` - Run script: `time scripts/bin/infra check` Before PR: ```log scripts/bin/infra check 44.44s user 8.89s system 108% cpu 49.289 total ``` After PR: ```log scripts/bin/infra check 33.69s user 3.25s system 137% cpu 26.921 total ```
1 parent 6963419 commit e229b5e

File tree

2 files changed

+30
-4
lines changed

2 files changed

+30
-4
lines changed

.devcontainer/devcontainer.json

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44
"build": {
55
"dockerfile": "Dockerfile"
66
},
7-
"postAttachCommand": "/bin/bash scripts/bin/infra setup",
7+
"postCreateCommand": {
8+
// Fix target volume permissions, if it is owned by root:
9+
"fixTargetVolumePermissions_hermit": "sudo chown -R $(whoami): /workspaces/${localWorkspaceFolderBasename}/.hermit",
10+
"fixTargetVolumePermissions_node_modules": "sudo chown -R $(whoami): /workspaces/${localWorkspaceFolderBasename}/node_modules",
11+
"fixTargetVolumePermissions_target": "sudo chown -R $(whoami): /workspaces/${localWorkspaceFolderBasename}/target"
12+
},
813
"portsAttributes": {
914
// _MKDOCS_WATCH_PORT_ | keep in sync with the port number defined in "$REPO_ROOT/crates/infra/cli/src/toolchains/mkdocs/mod.rs"
1015
"5353": {
@@ -44,5 +49,24 @@
4449
"GitHub.vscode-pull-request-github"
4550
]
4651
}
47-
}
52+
},
53+
"mounts": [
54+
// Use Docker named volumes for I/O-intensive directories to speed up builds:
55+
// https://docs.docker.com/engine/storage/volumes/
56+
{
57+
"source": "slang_hermit_mount",
58+
"target": "/workspaces/${localWorkspaceFolderBasename}/.hermit",
59+
"type": "volume"
60+
},
61+
{
62+
"source": "slang_node_modules_mount",
63+
"target": "/workspaces/${localWorkspaceFolderBasename}/node_modules",
64+
"type": "volume"
65+
},
66+
{
67+
"source": "slang_target_mount",
68+
"target": "/workspaces/${localWorkspaceFolderBasename}/target",
69+
"type": "volume"
70+
}
71+
]
4872
}

.github/workflows/ci.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,10 @@ jobs:
5858
- name: "Checkout Repository"
5959
uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683"
6060

61-
# NOTE:
62-
# No need to run 'infra setup', as it runs automatically when the devcontainer is launched.
61+
- name: "infra setup pipenv"
62+
uses: "./.github/actions/devcontainer/run"
63+
with:
64+
runCmd: "./scripts/bin/infra setup pipenv"
6365

6466
- name: "infra lint mkdocs"
6567
uses: "./.github/actions/devcontainer/run"

0 commit comments

Comments
 (0)