dev container修正

This commit is contained in:
2026-04-20 13:28:47 +08:00
parent 21c5e050f3
commit 3e7ef0f891
4 changed files with 23 additions and 2 deletions

View File

@@ -27,5 +27,9 @@
"SPRING_PROFILES_ACTIVE": "dev",
"K12STUDY_DEV_MODE": "external"
},
"postCreateCommand": "cd /workspaces/K12study"
"remoteUser": "codespace",
"updateRemoteUserUID": true,
"postCreateCommand": "sudo chown -R codespace:codespace /pnpm-store /workspaces/K12study/frontend/node_modules"
}

View File

@@ -3,9 +3,17 @@ services:
image: mcr.microsoft.com/devcontainers/universal:2
volumes:
- ../../:/workspaces/K12study:cached
- frontend-node-modules:/workspaces/K12study/frontend/node_modules
- pnpm-store:/pnpm-store
working_dir: /workspaces/K12study
command: sleep infinity
user: 1000:1000 # 👈 强制权限,最关键
environment:
NPM_CONFIG_USER: 1000
PNPM_HOME: /pnpm-store
PNPM_STORE_DIR: /pnpm-store
# 你原来的所有环境变量...
K12STUDY_DB_HOST: ${K12STUDY_DB_HOST:-host.docker.internal}
K12STUDY_DB_PORT: ${K12STUDY_DB_PORT:-5432}
K12STUDY_DB_NAME: ${K12STUDY_DB_NAME:-k12study}
@@ -30,3 +38,7 @@ services:
PYTHONUNBUFFERED: "1"
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
frontend-node-modules:
pnpm-store:

View File

@@ -39,5 +39,5 @@
"SPRING_PROFILES_ACTIVE": "dev",
"K12STUDY_DEV_MODE": "internal"
},
"postCreateCommand": "cd /workspaces/K12study/frontend && pnpm install"
"postCreateCommand": "sudo chown -R codespace:codespace /pnpm-store /workspaces/K12study/frontend/node_modules && cd /workspaces/K12study/frontend && pnpm install"
}

View File

@@ -3,6 +3,8 @@ services:
image: mcr.microsoft.com/devcontainers/universal:2
volumes:
- ../../:/workspaces/K12study:cached
- frontend-node-modules:/workspaces/K12study/frontend/node_modules
- pnpm-store:/pnpm-store
working_dir: /workspaces/K12study
command: sleep infinity
environment:
@@ -26,6 +28,7 @@ services:
K12STUDY_VECTOR_PORT: 19530
K12STUDY_VECTOR_HTTP_PORT: 9091
PYTHONUNBUFFERED: "1"
PNPM_STORE_DIR: /pnpm-store
depends_on:
- postgres
- redis
@@ -151,6 +154,8 @@ services:
- milvus-dev-data:/var/lib/milvus
volumes:
frontend-node-modules:
pnpm-store:
postgres-dev-data:
redis-dev-data:
nacos-dev-logs: