AIClient-2-API/Dockerfile
hex2077 a6d9eb1d6f fix: 修正Dockerfile中master.js路径错误
更新CMD指令中的文件路径,从src/master.js改为src/core/master.js,以匹配实际项目结构
2026-01-10 18:55:39 +08:00

41 lines
No EOL
1.1 KiB
Docker
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 使用官方Node.js运行时作为基础镜像
# 选择20-alpine版本以满足undici包的要求需要Node.js >=20.18.1
FROM node:20-alpine
# 设置标签
LABEL maintainer="AIClient2API Team"
LABEL description="Docker image for AIClient2API server"
# 安装必要的系统工具tar 用于更新功能git 用于版本检查)
RUN apk add --no-cache tar git
# 设置工作目录
WORKDIR /app
# 复制package.json和package-lock.json如果存在
COPY package*.json ./
# 安装依赖
# 使用--production标志只安装生产依赖减小镜像大小
# 使用--omit=dev来排除开发依赖
RUN npm install
# 复制源代码
COPY . .
USER root
# 创建目录用于存储日志和系统提示文件
RUN mkdir -p /app/logs
# 暴露端口
EXPOSE 3000 8085 8086 19876-19880
# 添加健康检查
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD node healthcheck.js || exit 1
# 设置启动命令
# 使用默认配置启动服务器,支持通过环境变量配置
# 通过环境变量传递参数例如docker run -e ARGS="--api-key mykey --port 8080" ...
CMD ["sh", "-c", "node src/core/master.js $ARGS"]