Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6f18868

Browse files
feat: allow customizing workspace directory (#2)
Allow specifying where code-server should be launched into.
1 parenta49fbbb commit6f18868

File tree

5 files changed

+39
-3
lines changed

5 files changed

+39
-3
lines changed

‎Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.PHONY: test
2+
test:
3+
devcontainer featurestest

‎src/code-server/devcontainer-feature.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@
2323
"extensions": {
2424
"type":"string",
2525
"default":""
26-
}
26+
},
27+
"workspace": {
28+
"type":"string",
29+
"default":""
30+
}
2731
},
2832
"entrypoint":"/usr/local/bin/code-server-entrypoint",
2933
"dependsOn": {

‎src/code-server/install.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set -e
33

44
CODE_SERVER_INSTALL_ARGS=""
55

6-
if [-n"$VERSION"];then
6+
if [[-n$VERSION ]];then
77
CODE_SERVER_INSTALL_ARGS="$CODE_SERVER_INSTALL_ARGS --version=\"$VERSION\""
88
fi
99

@@ -17,12 +17,18 @@ do
1717
code-server --install-extension"$extension"
1818
done
1919

20+
CODE_SERVER_WORKSPACE="$_REMOTE_USER_HOME"
21+
22+
if [[-n$WORKSPACE ]];then
23+
CODE_SERVER_WORKSPACE="$WORKSPACE"
24+
fi
25+
2026
cat> /usr/local/bin/code-server-entrypoint \
2127
<<EOF
2228
#!/usr/bin/env bash
2329
set -e
2430
25-
su$_REMOTE_USER -c 'code-server --bind-addr "$HOST:$PORT"\$ARGS'
31+
su$_REMOTE_USER -c 'code-server --bind-addr "$HOST:$PORT""$CODE_SERVER_WORKSPACE"'
2632
EOF
2733

2834
chmod +x /usr/local/bin/code-server-entrypoint
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Optional: Import test library bundled with the devcontainer CLI
5+
source dev-container-features-test-lib
6+
7+
# Feature-specific tests
8+
check"code-server version" code-server --version
9+
check"code-server running" pgrep -f'code-server/lib/node.*/code-server'
10+
check"code-server listening" lsof -i"@127.0.0.1:8080"
11+
12+
check"code-server workspace" grep$'\'code-server.*"/home"\''< /usr/local/bin/code-server-entrypoint
13+
14+
# Report results
15+
reportResults

‎test/code-server/scenarios.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,13 @@
3030
"version":"4.98.0"
3131
}
3232
}
33+
},
34+
"code-server-workspace": {
35+
"image":"mcr.microsoft.com/devcontainers/base:ubuntu",
36+
"features": {
37+
"code-server": {
38+
"workspace":"/home"
39+
}
40+
}
3341
}
3442
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp