FROM node:20 WORKDIR /app # 克隆代码 RUN git clone https://github.com/OpenListTeam/cf-worker-api.git . # 复制配置文件(从仓库内复制) RUN cp wrangler.jsonc.example wrangler.jsonc # 安装依赖 RUN npm install # 修复权限问题 RUN chmod -R 755 /app && \ chown -R node:node /app # 切换到非 root 用户 USER node # 暴露 Wrangler 开发服务器端口 EXPOSE 8787 # 启动 Wrangler 开发服务器(绑定所有接口) CMD ["npx", "wrangler", "dev", "--port", "8787", "--ip", "0.0.0.0"]