FROM agentscope/copaw:latest USER root # 安装 nginx 和生成密码工具 RUN apt-get update && apt-get install -y nginx apache2-utils && rm -rf /var/lib/apt/lists/* # 设置内部变量 ENV HOST=127.0.0.1 ENV PORT=8088 WORKDIR /app/working RUN mkdir -p /app/working /app/working.secret && chmod -R 777 /app/working # 配置 Nginx RUN echo 'server {\n\ listen 7860;\n\ location / {\n\ auth_basic "Restricted Area";\n\ auth_basic_user_file /etc/nginx/.htpasswd;\n\ proxy_pass http://127.0.0.1:8088;\n\ proxy_set_header Host $host;\n\ proxy_set_header X-Real-IP $remote_addr;\n\ proxy_set_header Upgrade $http_upgrade;\n\ proxy_set_header Connection "upgrade";\n\ }\n\ }' > /etc/nginx/sites-available/default # 启动脚本 CMD htpasswd -b -c /etc/nginx/.htpasswd admin $APP_PASSWORD && \ service nginx start && \ copaw app --host 127.0.0.1 --port 8088