update
Browse files- Dockerfile +1 -1
- docker-start.sh +9 -1
Dockerfile
CHANGED
|
@@ -9,7 +9,7 @@ RUN apt-get update && apt-get install -y curl && \
|
|
| 9 |
# 复制自定义配置文件
|
| 10 |
COPY nginx/nginx.conf /usr/local/openresty/nginx/conf/nginx.conf
|
| 11 |
COPY nginx/conf.d/default.conf /usr/local/openresty/nginx/conf/conf.d/default.conf
|
| 12 |
-
|
| 13 |
|
| 14 |
# 复制静态文件
|
| 15 |
COPY nginx/html/ /usr/local/openresty/nginx/html/
|
|
|
|
| 9 |
# 复制自定义配置文件
|
| 10 |
COPY nginx/nginx.conf /usr/local/openresty/nginx/conf/nginx.conf
|
| 11 |
COPY nginx/conf.d/default.conf /usr/local/openresty/nginx/conf/conf.d/default.conf
|
| 12 |
+
# 不再复制静态 .htpasswd 文件,将在启动时动态生成
|
| 13 |
|
| 14 |
# 复制静态文件
|
| 15 |
COPY nginx/html/ /usr/local/openresty/nginx/html/
|
docker-start.sh
CHANGED
|
@@ -7,10 +7,18 @@ echo "🚀 Starting OpenResty + OpenCode Integration..."
|
|
| 7 |
# 检查环境变量
|
| 8 |
export GATEWAY_HOST=${GATEWAY_HOST:-127.0.0.1}
|
| 9 |
export GATEWAY_PORT=${GATEWAY_PORT:-57860}
|
|
|
|
|
|
|
| 10 |
|
| 11 |
echo "📍 OpenCode will listen on: ${GATEWAY_HOST}:${GATEWAY_PORT}"
|
| 12 |
echo "🌐 Nginx will listen on: 0.0.0.0:7860"
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
# 启动 OpenCode 服务器在后台
|
| 15 |
echo "🤖 Starting OpenCode server on port ${GATEWAY_PORT}..."
|
| 16 |
opencode serve --port ${GATEWAY_PORT} --hostname ${GATEWAY_HOST} &
|
|
@@ -60,7 +68,7 @@ echo " • OpenCode API: http://localhost:7860/opencode/"
|
|
| 60 |
echo " • OpenCode Docs: http://localhost:7860/opencode/doc"
|
| 61 |
echo " • API Gateway Health: http://localhost:7860/gateway/health"
|
| 62 |
echo ""
|
| 63 |
-
echo "🔐 Authentication:
|
| 64 |
echo ""
|
| 65 |
echo "🤖 OpenCode Status:"
|
| 66 |
if curl -s http://${GATEWAY_HOST}:${GATEWAY_PORT}/global/health > /dev/null; then
|
|
|
|
| 7 |
# 检查环境变量
|
| 8 |
export GATEWAY_HOST=${GATEWAY_HOST:-127.0.0.1}
|
| 9 |
export GATEWAY_PORT=${GATEWAY_PORT:-57860}
|
| 10 |
+
export USERNAME=${USERNAME:-admin}
|
| 11 |
+
export PASSWORD=${PASSWORD:-admin123}
|
| 12 |
|
| 13 |
echo "📍 OpenCode will listen on: ${GATEWAY_HOST}:${GATEWAY_PORT}"
|
| 14 |
echo "🌐 Nginx will listen on: 0.0.0.0:7860"
|
| 15 |
|
| 16 |
+
# 动态生成 .htpasswd 文件
|
| 17 |
+
HTPASSWD_FILE="/usr/local/openresty/nginx/conf/.htpasswd"
|
| 18 |
+
echo "🔐 Generating .htpasswd file with user: ${USERNAME}"
|
| 19 |
+
echo "${USERNAME}:$(openssl passwd -apr1 ${PASSWORD})" > ${HTPASSWD_FILE}
|
| 20 |
+
echo "✅ .htpasswd file generated at ${HTPASSWD_FILE}"
|
| 21 |
+
|
| 22 |
# 启动 OpenCode 服务器在后台
|
| 23 |
echo "🤖 Starting OpenCode server on port ${GATEWAY_PORT}..."
|
| 24 |
opencode serve --port ${GATEWAY_PORT} --hostname ${GATEWAY_HOST} &
|
|
|
|
| 68 |
echo " • OpenCode Docs: http://localhost:7860/opencode/doc"
|
| 69 |
echo " • API Gateway Health: http://localhost:7860/gateway/health"
|
| 70 |
echo ""
|
| 71 |
+
echo "🔐 Authentication: ${USERNAME}/${PASSWORD}"
|
| 72 |
echo ""
|
| 73 |
echo "🤖 OpenCode Status:"
|
| 74 |
if curl -s http://${GATEWAY_HOST}:${GATEWAY_PORT}/global/health > /dev/null; then
|