FreeLLMAPI / Dockerfile
javaeeduke's picture
Update Dockerfile
eadc41e verified
Raw History Blame
759 Bytes
FROM node:20-slim AS builder
WORKDIR /app
# 冲刷缓存专用时间戳:2026-05-30
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
RUN git clone https://github.com/tashfeenahmed/freellmapi.git .
RUN npm install
RUN npm run build
# --- 生产运行环境 ---
FROM node:20-slim AS runner
WORKDIR /app
COPY --from=builder /app ./
# 确保开辟真目录
RUN mkdir -p /data/freellm
EXPOSE 7860
ENV PORT=7860
ENV NODE_ENV=production
# 终极无敌运行命令(每次启动时在内存里做软链接绑定)
CMD ["sh", "-c", "rm -rf /app/server/data && ln -s /data/freellm /app/server/data && export ENCRYPTION_KEY=$(node -e \"console.log(require('crypto').randomBytes(32).toString('hex'))\") && node server/dist/index.js"]