添加OpenCode配置文件:设置正确的public URL以支持代理环境
Browse files- Dockerfile +3 -0
- docker-start.sh +2 -0
- opencode.json +8 -0
Dockerfile
CHANGED
|
@@ -14,6 +14,9 @@ COPY nginx/conf.d/default.conf /usr/local/openresty/nginx/conf/conf.d/default.co
|
|
| 14 |
# 复制静态文件
|
| 15 |
COPY nginx/html/ /usr/local/openresty/nginx/html/
|
| 16 |
|
|
|
|
|
|
|
|
|
|
| 17 |
# 创建 OpenCode 启动脚本
|
| 18 |
COPY docker-start.sh /docker-start.sh
|
| 19 |
RUN chmod +x /docker-start.sh
|
|
|
|
| 14 |
# 复制静态文件
|
| 15 |
COPY nginx/html/ /usr/local/openresty/nginx/html/
|
| 16 |
|
| 17 |
+
# 复制 OpenCode 配置文件
|
| 18 |
+
COPY opencode.json /app/opencode.json
|
| 19 |
+
|
| 20 |
# 创建 OpenCode 启动脚本
|
| 21 |
COPY docker-start.sh /docker-start.sh
|
| 22 |
RUN chmod +x /docker-start.sh
|
docker-start.sh
CHANGED
|
@@ -21,6 +21,8 @@ echo "✅ .htpasswd file generated at ${HTPASSWD_FILE}"
|
|
| 21 |
|
| 22 |
# 启动 OpenCode Web服务器在后台
|
| 23 |
echo "🤖 Starting OpenCode web server on port ${GATEWAY_PORT}..."
|
|
|
|
|
|
|
| 24 |
# 添加CORS支持,允许所有来源(在代理环境中)
|
| 25 |
opencode web --port ${GATEWAY_PORT} --hostname ${GATEWAY_HOST} --cors "*" &
|
| 26 |
OPENCODE_PID=$!
|
|
|
|
| 21 |
|
| 22 |
# 启动 OpenCode Web服务器在后台
|
| 23 |
echo "🤖 Starting OpenCode web server on port ${GATEWAY_PORT}..."
|
| 24 |
+
# 确保在正确的目录中启动
|
| 25 |
+
cd /app
|
| 26 |
# 添加CORS支持,允许所有来源(在代理环境中)
|
| 27 |
opencode web --port ${GATEWAY_PORT} --hostname ${GATEWAY_HOST} --cors "*" &
|
| 28 |
OPENCODE_PID=$!
|
opencode.json
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"$schema": "https://opencode.ai/config.json",
|
| 3 |
+
"server": {
|
| 4 |
+
"publicUrl": "https://airsltd-ocngx.hf.space/opencode"
|
| 5 |
+
},
|
| 6 |
+
"theme": "opencode",
|
| 7 |
+
"autoupdate": true
|
| 8 |
+
}
|