Skip to content

Commit f33ea37

Browse files
authored
Merge pull request #410 from linuxserver/code-server-extension-arguments-s6v3
switch to hybrid (code-server-extension-arguments)
2 parents 03547a5 + db6f2d2 commit f33ea37

File tree

8 files changed

+40
-8
lines changed

8 files changed

+40
-8
lines changed

README.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
1-
# Extension Arguments - Docker mod for code-server
1+
# Extension Arguments - Docker mod for code-server/openvscode-server
2+
3+
This mod installs code-server/openvscode-server extensions at startup. The list of extensions to be installed should be provided using environment variable `VSCODE_EXTENSION_IDS` separated by `|`.
4+
5+
__NOTE__:
6+
Since transitioning from `v3.12.0` to `v4.0.x` `code-server` has been forced to use a new Extensions Gallery / Marketplace. This results in a smaller set of plugins being available to install. Please take this into account before opening an Issue!
7+
8+
A workaround for this is to use the environment variable `EXTENSIONS_GALLERY` to provide a different marketplace URL. The commandline installer used by this plugin will also use the marketplace provided by this variable.
9+
10+
Please refer to the [code-server FAQ](https://github.com/coder/code-server/blob/main/docs/FAQ.md#how-do-i-use-my-own-extensions-marketplace) for additional information.
211

3-
This mod installs code-server extensions at startup. The list of extensions to be installed should be provided using environment variable `VSCODE_EXTENSION_IDS` separated by `|`.
412

513
For example, to install the `vscode-docker` and `vscode-icons` extensions add the following lines to your docker compose service:
614
```yaml
7-
- DOCKER_MODS=linuxserver/mods:code-server-docker|linuxserver/mods:code-server-extension-arguments
8-
- VSCODE_EXTENSION_IDS=vscode-icons-team.vscode-icons|ms-azuretools.vscode-docker
15+
environment:
16+
DOCKER_MODS: 'linuxserver/mods:code-server-docker|linuxserver/mods:code-server-extension-arguments'
17+
VSCODE_EXTENSION_IDS: 'vscode-icons-team.vscode-icons|ms-azuretools.vscode-docker'
18+
## Optionally use a different marketplace if required extensions are unavailable. e.g.:
19+
# EXTENSIONS_GALLERY: '{"serviceUrl": "https://extensions.coder.com/api"}'
20+
# EXTENSIONS_GALLERY: '{"serviceUrl": "https://open-vsx.org/vscode/gallery", "itemUrl": "https://open-vsx.org/vscode/item"}'
921
```

root/etc/cont-init.d/99-install-extensions

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,15 @@ if [ -z ${VSCODE_EXTENSION_IDS+x} ]; then
66
exit 0
77
fi
88

9-
109
IFS='|'
1110
VSCODE_EXTENSION_IDS=(${VSCODE_EXTENSION_IDS})
12-
for ID in "${VSCODE_EXTENSION_IDS[@]}"; do
13-
echo "**** installing extension: ${ID} ****"
11+
# Use newly available abstraction if available (>= v4.0.x), else fallback to old method.
12+
if [ -x "$(command -v install-extension)" ]; then
13+
for ID in "${VSCODE_EXTENSION_IDS[@]}"; do
14+
install-extension ${ID}
15+
done
16+
else
17+
for ID in "${VSCODE_EXTENSION_IDS[@]}"; do
1418
s6-setuidgid abc code-server --user-data-dir /config/data --extensions-dir /config/extensions --install-extension ${ID}
15-
done
19+
done
20+
fi

root/etc/s6-overlay/s6-rc.d/init-mod-code-server-extension-arguments/dependencies.d/init-mods

Whitespace-only changes.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/with-contenv bash
2+
3+
# Exit if no VsCode extensions are given
4+
if [ -z ${VSCODE_EXTENSION_IDS+x} ]; then
5+
echo "**** No VSCODE EXTENSIONS GIVEN****"
6+
exit 0
7+
fi
8+
9+
IFS='|'
10+
VSCODE_EXTENSION_IDS=(${VSCODE_EXTENSION_IDS})
11+
for ID in "${VSCODE_EXTENSION_IDS[@]}"; do
12+
install-extension ${ID}
13+
done
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
oneshot
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/etc/s6-overlay/s6-rc.d/init-mod-code-server-extension-arguments/run

root/etc/s6-overlay/s6-rc.d/init-mods-end/dependencies.d/init-mod-code-server-extension-arguments

Whitespace-only changes.

root/etc/s6-overlay/s6-rc.d/user/contents.d/init-mod-code-server-extension-arguments

Whitespace-only changes.

0 commit comments

Comments
 (0)