File size: 1,175 Bytes
09af5b8 fffb5c4 2ef75d9 5144611 2ef75d9 5144611 2ef75d9 fffb5c4 09af5b8 bb07043 fffb5c4 09af5b8 10656cf 1b4f076 5144611 10656cf 2ef75d9 fffb5c4 2ef75d9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | FROM openresty/openresty:latest
# 安装 Node.js (用于 OpenCode)
RUN apt-get update && apt-get install -y curl cron && \
curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
apt-get install -y nodejs && \
npm install -g opencode-ai
# 复制自定义配置文件
COPY nginx/nginx.conf /usr/local/openresty/nginx/conf/nginx.conf
COPY nginx/conf.d/default.conf /usr/local/openresty/nginx/conf/conf.d/default.conf
# 不再复制静态 .htpasswd 文件,将在启动时动态生成
# 复制静态文件
COPY nginx/html/ /usr/local/openresty/nginx/html/
# 复制 OpenCode 配置文件
COPY opencode.json /app/opencode.json
COPY AGENT.md /etc/AGENT.md
# 复制 Cron 配置文件和脚本
COPY crontab /etc/cron.d/ocngx-cron
COPY cron-jobs/ /etc/cron-jobs/
# 设置 Cron 配置权限
RUN chmod 0644 /etc/cron.d/ocngx-cron && \
crontab /etc/cron.d/ocngx-cron && \
chmod +x /etc/cron-jobs/*.sh
# 创建 OpenCode 启动脚本
COPY docker-start.sh /docker-start.sh
RUN chmod +x /docker-start.sh
# 暴露端口(Hugging Face Spaces 通常使用 7860)
EXPOSE 7860
# 启动脚本(同时启动 OpenResty 和 OpenCode)
CMD ["/docker-start.sh"] |