Skip to content

Commit 87d052e

Browse files
authored
feat(.devcontainer): add cursor, filebrowser, windsurf and zed (#18608)
1 parent c6e0ba1 commit 87d052e

File tree

3 files changed

+136
-1
lines changed

3 files changed

+136
-1
lines changed

.devcontainer/devcontainer.json

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"ghcr.io/coder/devcontainer-features/code-server:1": {
1010
"auth": "none",
1111
"port": 13337
12-
}
12+
},
13+
"./filebrowser": {}
1314
},
1415
// SYS_PTRACE to enable go debugging
1516
"runArgs": [
@@ -20,6 +21,34 @@
2021
"extensions": [
2122
"biomejs.biome"
2223
]
24+
},
25+
"coder": {
26+
"apps": [
27+
{
28+
"slug": "cursor",
29+
"displayName": "Cursor Desktop",
30+
"url": "cursor://coder.coder-remote/openDevContainer?owner=${localEnv:CODER_WORKSPACE_OWNER_NAME}&workspace=${localEnv:CODER_WORKSPACE_NAME}&agent=${localEnv:CODER_WORKSPACE_PARENT_AGENT_NAME}&url=${localEnv:CODER_URL}&token=$SESSION_TOKEN&devContainerName=${localEnv:CONTAINER_ID}&devContainerFolder=${containerWorkspaceFolder}",
31+
"external": true,
32+
"icon": "/icon/cursor.svg",
33+
"order": 1
34+
},
35+
{
36+
"slug": "windsurf",
37+
"displayName": "Windsurf Editor",
38+
"url": "windsurf://coder.coder-remote/openDevContainer?owner=${localEnv:CODER_WORKSPACE_OWNER_NAME}&workspace=${localEnv:CODER_WORKSPACE_NAME}&agent=${localEnv:CODER_WORKSPACE_PARENT_AGENT_NAME}&url=${localEnv:CODER_URL}&token=$SESSION_TOKEN&devContainerName=${localEnv:CONTAINER_ID}&devContainerFolder=${containerWorkspaceFolder}",
39+
"external": true,
40+
"icon": "/icon/windsurf.svg",
41+
"order": 4
42+
},
43+
{
44+
"slug": "zed",
45+
"displayName": "Zed Editor",
46+
"url": "zed://ssh/${localEnv:CODER_WORKSPACE_AGENT_NAME}.${localEnv:CODER_WORKSPACE_NAME}.${localEnv:CODER_WORKSPACE_OWNER_NAME}.coder/${containerWorkspaceFolder}",
47+
"external": true,
48+
"icon": "/icon/zed.svg",
49+
"order": 5
50+
}
51+
]
2352
}
2453
},
2554
"mounts": [
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"id": "filebrowser",
3+
"version": "0.0.1",
4+
"name": "File Browser",
5+
"description": "A web-based file browser for your development container",
6+
"options": {
7+
"port": {
8+
"type": "string",
9+
"default": "13339",
10+
"description": "The port to run filebrowser on"
11+
},
12+
// "folder": {
13+
// "type": "string",
14+
// "default": "${containerWorkspaceFolder}",
15+
// "description": "The root directory for filebrowser to serve"
16+
// },
17+
"auth": {
18+
"type": "string",
19+
"enum": [
20+
"none",
21+
"password"
22+
],
23+
"default": "none",
24+
"description": "Authentication method (none or password)"
25+
}
26+
},
27+
"entrypoint": "/usr/local/bin/filebrowser-entrypoint",
28+
"dependsOn": {
29+
"ghcr.io/devcontainers/features/common-utils:2": {}
30+
},
31+
"customizations": {
32+
"coder": {
33+
"apps": [
34+
{
35+
"slug": "filebrowser",
36+
"displayName": "File Browser",
37+
"url": "http://localhost:${localEnv:FEATURE_FILEBROWSER_OPTION_PORT:13339}",
38+
"icon": "/icon/filebrowser.svg",
39+
"order": 3,
40+
"subdomain": true,
41+
"healthcheck": {
42+
"url": "http://localhost:${localEnv:FEATURE_FILEBROWSER_OPTION_PORT:13339}/health",
43+
"interval": 5,
44+
"threshold": 6
45+
}
46+
}
47+
]
48+
}
49+
}
50+
}

.devcontainer/filebrowser/install.sh

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
BOLD='\033[0;1m'
6+
7+
printf "%sInstalling filebrowser\n\n" "${BOLD}"
8+
9+
# Check if filebrowser is installed.
10+
if ! command -v filebrowser &>/dev/null; then
11+
curl -fsSL https://raw.githubusercontent.com/filebrowser/get/master/get.sh | bash
12+
fi
13+
14+
printf "🥳 Installation complete!\n\n"
15+
16+
# Create run script.
17+
cat >/usr/local/bin/filebrowser-entrypoint <<EOF
18+
#!/bin/bash
19+
20+
printf "🛠️ Configuring filebrowser\n\n"
21+
22+
AUTH="${AUTH}"
23+
PORT="${PORT}"
24+
FOLDER="$(pwd)"
25+
LOG_PATH=/tmp/filebrowser.log
26+
export FB_DATABASE="/tmp/filebrowser.db"
27+
28+
# Check if filebrowser db exists.
29+
if [[ ! -f "\${FB_DATABASE}" ]]; then
30+
filebrowser config init
31+
if [[ "\$AUTH" == "password" ]]; then
32+
filebrowser users add admin admin --perm.admin=true --viewMode=mosaic
33+
fi
34+
fi
35+
36+
# Configure filebrowser.
37+
if [[ "\$AUTH" == "none" ]]; then
38+
filebrowser config set --port="\${PORT}" --auth.method=noauth --root="\${FOLDER}"
39+
else
40+
filebrowser config set --port="\${PORT}" --auth.method=json --root="\${FOLDER}"
41+
fi
42+
43+
set -euo pipefail
44+
45+
printf "👷 Starting filebrowser...\n\n"
46+
printf "📂 Serving \${FOLDER} at http://localhost:\${PORT}\n\n"
47+
48+
filebrowser >>\${LOG_PATH} 2>&1 &
49+
50+
printf "📝 Logs at \${LOG_PATH}\n\n"
51+
EOF
52+
53+
chmod +x /usr/local/bin/filebrowser-entrypoint
54+
55+
printf "✅ File Browser installed!\n\n"
56+
printf "🚀 Run 'filebrowser-entrypoint' to start the service\n\n"

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy