Skip to content

Commit ad7262b

Browse files
chore(devenv): More improvements to dev container workflow (#833)
1 parent 10f2ee0 commit ad7262b

File tree

4 files changed

+79
-45
lines changed

4 files changed

+79
-45
lines changed

.devcontainer/devcontainer.json

Lines changed: 44 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,52 @@
11
{
2-
"name": "Sourcebot Development",
3-
"dockerComposeFile": "docker-compose.yml",
4-
"service": "devcontainer",
5-
"workspaceFolder": "/workspaces/sourcebot",
2+
"name": "Sourcebot Development",
3+
"dockerComposeFile": "docker-compose.yml",
4+
"service": "devcontainer",
5+
"workspaceFolder": "/workspaces/sourcebot",
66

7-
"features": {
8-
"ghcr.io/devcontainers/features/git:1": {},
9-
"ghcr.io/devcontainers/features/github-cli:1": {}
10-
},
7+
"features": {
8+
"ghcr.io/devcontainers/features/git:1": {},
9+
"ghcr.io/devcontainers/features/github-cli:1": {}
10+
},
1111

12-
"forwardPorts": [3000],
13-
"portsAttributes": {
14-
"3000": { "label": "Web App", "onAutoForward": "notify" }
15-
},
12+
"remoteEnv": {
13+
"AUTH_URL": "https://${containerEnv:CODESPACE_NAME}-3000.app.github.dev"
14+
},
1615

17-
"initializeCommand": "git submodule update --init --recursive",
18-
"postCreateCommand": "bash .devcontainer/scripts/post-create.sh",
19-
"postStartCommand": "bash .devcontainer/scripts/post-start.sh",
16+
"forwardPorts": [3000],
17+
"portsAttributes": {
18+
"3000": { "label": "Web App", "onAutoForward": "notify" }
19+
},
2020

21-
"customizations": {
22-
"vscode": {
23-
"extensions": [
24-
"dbaeumer.vscode-eslint",
25-
"bradlc.vscode-tailwindcss",
26-
"Prisma.prisma",
27-
"esbenp.prettier-vscode",
28-
"golang.go",
29-
"ms-azuretools.vscode-docker",
30-
"mikestead.dotenv",
31-
"eamodio.gitlens"
32-
],
33-
"settings": {
34-
"editor.formatOnSave": true,
35-
"editor.defaultFormatter": "esbenp.prettier-vscode",
36-
"[typescript]": {
37-
"editor.defaultFormatter": "esbenp.prettier-vscode"
38-
},
39-
"[typescriptreact]": {
40-
"editor.defaultFormatter": "esbenp.prettier-vscode"
41-
},
42-
"[prisma]": {
43-
"editor.defaultFormatter": "Prisma.prisma"
21+
"initializeCommand": "git submodule update --init --recursive",
22+
"postCreateCommand": "bash .devcontainer/scripts/post-create.sh",
23+
"postStartCommand": "bash .devcontainer/scripts/post-start.sh",
24+
25+
"customizations": {
26+
"vscode": {
27+
"extensions": [
28+
"dbaeumer.vscode-eslint",
29+
"bradlc.vscode-tailwindcss",
30+
"Prisma.prisma",
31+
"esbenp.prettier-vscode",
32+
"golang.go",
33+
"eamodio.gitlens"
34+
],
35+
"settings": {
36+
"editor.formatOnSave": false,
37+
"editor.defaultFormatter": "esbenp.prettier-vscode",
38+
"[typescript]": {
39+
"editor.defaultFormatter": "esbenp.prettier-vscode"
40+
},
41+
"[typescriptreact]": {
42+
"editor.defaultFormatter": "esbenp.prettier-vscode"
43+
},
44+
"[prisma]": {
45+
"editor.defaultFormatter": "Prisma.prisma"
46+
}
47+
}
4448
}
45-
}
46-
}
47-
},
49+
},
4850

49-
"remoteUser": "node"
51+
"remoteUser": "node"
5052
}

.devcontainer/scripts/post-create.sh

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,32 @@ cd /workspaces/sourcebot
1010

1111
# 1. Initialize git submodules (in case initializeCommand didn't run)
1212
echo ""
13-
echo "[1/2] Initializing git submodules..."
13+
echo "[1/4] Initializing git submodules..."
1414
git submodule update --init --recursive
1515

1616
# 2. Build Zoekt and install dependencies (uses Makefile)
1717
echo ""
18-
echo "[2/2] Building Zoekt and installing dependencies..."
18+
echo "[2/4] Building Zoekt and installing dependencies..."
1919
make
2020

21+
echo ""
22+
echo "[3/4] Running database migrations..."
23+
yarn dev:prisma:migrate:dev
24+
25+
echo ""
26+
echo "[4/4] Creating default config.json..."
27+
cat > config.json << 'EOF'
28+
{
29+
"$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json",
30+
"connections": {
31+
"github": {
32+
"type": "github",
33+
"repos": ["sourcebot-dev/sourcebot"]
34+
}
35+
}
36+
}
37+
EOF
38+
2139
echo ""
2240
echo "=========================================="
2341
echo "Post-create setup complete!"

.prettierrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"tabWidth": 4
3+
}

packages/web/next.config.mjs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,18 @@ const nextConfig = {
3838
]
3939
},
4040

41-
turbopack: {}
41+
turbopack: {},
42+
43+
// @see: https://github.com/vercel/next.js/issues/58019#issuecomment-1910531929
44+
...(process.env.NODE_ENV === 'development' ? {
45+
experimental: {
46+
serverActions: {
47+
allowedOrigins: [
48+
'localhost:3000'
49+
]
50+
}
51+
}
52+
} : {}),
4253
};
4354

4455
export default withSentryConfig(nextConfig, {

0 commit comments

Comments
 (0)