File tree Expand file tree Collapse file tree 5 files changed +39
-3
lines changed Expand file tree Collapse file tree 5 files changed +39
-3
lines changed Original file line number Diff line number Diff line change 1+ .PHONY : test
2+ test :
3+ devcontainer features test
Original file line number Diff line number Diff line change 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" : {
Original file line number Diff line number Diff line change 33
44CODE_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 \" "
88fi
99
1717 code-server --install-extension " $extension "
1818done
1919
20+ CODE_SERVER_WORKSPACE=" $_REMOTE_USER_HOME "
21+
22+ if [[ -n $WORKSPACE ]]; then
23+ CODE_SERVER_WORKSPACE=" $WORKSPACE "
24+ fi
25+
2026cat > /usr/local/bin/code-server-entrypoint \
2127<< EOF
2228#!/usr/bin/env bash
2329set -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 " '
2632EOF
2733
2834chmod +x /usr/local/bin/code-server-entrypoint
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 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}
You can’t perform that action at this time.
0 commit comments