Qwen2API / Dockerfile
xhserver's picture
Update Dockerfile
ced102b verified
Raw
History Blame
665 Bytes
FROM node:lts-alpine
# 全局安装PM2
RUN npm install -g pm2
# 安装git
RUN apk add --no-cache git
# 克隆Qwen2API仓库
RUN git clone https://github.com/Rfym21/Qwen2API.git /app
WORKDIR /app
# 安装后端依赖
RUN npm install
# 构建前端应用(生成 public/dist/index.html)
RUN cd public && npm install && npm run build
# 删除前端源码和 node_modules,减小镜像体积
RUN rm -rf public/src public/node_modules public/package*.json
# 设置权限
RUN chmod 777 /app
# 创建日志目录
RUN mkdir -p logs
# 暴露端口(程序默认7860,可通过环境变量SERVICE_PORT修改)
EXPOSE 7860
# 启动应用
CMD ["npm", "start"]