Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f105756

Browse files
committed
feat(devcontainer): add cursor, filebrowser, windsurf and zed
1 parent 872aef3 commit f105756

File tree

4 files changed

+148
-11
lines changed

4 files changed

+148
-11
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}/${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": "${workspaceFolder}",
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"

dogfood/coder/main.tf

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -328,19 +328,21 @@ module "coder-login" {
328328
}
329329

330330
module "cursor" {
331-
count = data.coder_workspace.me.start_count
332-
source = "dev.registry.coder.com/coder/cursor/coder"
333-
version = "1.1.0"
334-
agent_id = coder_agent.dev.id
335-
folder = local.repo_dir
331+
count = data.coder_workspace.me.start_count
332+
source = "dev.registry.coder.com/coder/cursor/coder"
333+
version = "1.1.0"
334+
agent_id = coder_agent.dev.id
335+
agent_name = "dev"
336+
folder = local.repo_dir
336337
}
337338

338339
module "windsurf" {
339-
count = data.coder_workspace.me.start_count
340-
source = "registry.coder.com/coder/windsurf/coder"
341-
version = "1.0.0"
342-
agent_id = coder_agent.dev.id
343-
folder = local.repo_dir
340+
count = data.coder_workspace.me.start_count
341+
source = "registry.coder.com/coder/windsurf/coder"
342+
version = "1.0.0"
343+
agent_id = coder_agent.dev.id
344+
agent_name = "dev"
345+
folder = local.repo_dir
344346
}
345347

346348
module "zed" {

0 commit comments

Comments
 (0)