zelin-bot / Dockerfile
Z User
v5.8.8: fix thinking leak, anti-manipulation compliance, hallucination of server data
cde5d07
FROM node:20-slim
# v5.8.7 - GLM 5.1 + clean deps (NO stealth) + MC Wiki + MC Player tools + optimized CPU
# ── System deps ──────────────────────────────────────────────────────────────
RUN apt-get update && apt-get install -y --no-install-recommends \
ffmpeg python3 make g++ git curl wget ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# ── CPU Performance optimizations ────────────────────────────────────────────
ENV NODE_OPTIONS="--max-old-space-size=4096"
ENV UV_THREADPOOL_SIZE=16
# ── ttyd: terminal web (optional) ───────────────────────────────────────────
RUN (wget -qO /usr/local/bin/ttyd "https://github.com/tsl0922/ttyd/releases/download/v1.7.7/ttyd.linux.x86_64" && chmod +x /usr/local/bin/ttyd) || \
echo "ttyd not available"
WORKDIR /app
# ── Copy package files first ────────────────────────────────────────────────
COPY package.json package-lock.json* ./
# ── Install Node.js dependencies ────────────────────────────────────────────
RUN npm install --production --ignore-scripts 2>&1 | tail -5 || \
npm install --legacy-peer-deps --ignore-scripts 2>&1 | tail -5 || true
# ── Install shims for removed heavy packages ────────────────────────────────
# Use CommonJS (not ESM) because some packages use require() internally
RUN for mod in sharp obs-websocket-js mineflayer-scaffold mineflayer-movement hawkeye playwright \
playwright-extra; do \
mkdir -p /app/node_modules/$mod && \
echo 'module.exports=function(){};module.exports.default=function(){};module.exports.plugin=function(){}' > /app/node_modules/$mod/index.js && \
echo '{}' > /app/node_modules/$mod/package.json; \
done && \
mkdir -p /app/node_modules/mineflayer-tool && \
echo 'function p(bot){bot.tool={equipForBlock:async()=>{},canDig:async()=>true};}module.exports=p;module.exports.default=p;module.exports.plugin=p;' > /app/node_modules/mineflayer-tool/index.js && \
echo '{"type":"commonjs"}' > /app/node_modules/mineflayer-tool/package.json && \
mkdir -p /app/node_modules/mineflayer-bloodhound && \
echo 'function p(){return function(bot){};}module.exports=p;module.exports.default=p;' > /app/node_modules/mineflayer-bloodhound/index.js && \
echo '{"type":"commonjs"}' > /app/node_modules/mineflayer-bloodhound/package.json && \
mkdir -p /app/node_modules/mineflayer-hawkeye && \
echo 'function p(bot){bot.hawkeye={attack:async()=>{}};}module.exports=p;module.exports.default=p;module.exports.plugin=p;' > /app/node_modules/mineflayer-hawkeye/index.js && \
echo '{"type":"commonjs"}' > /app/node_modules/mineflayer-hawkeye/package.json
# ── Copy application code ───────────────────────────────────────────────────
COPY . .
# ── Setup ───────────────────────────────────────────────────────────────────
RUN mkdir -p /app/videos /app/recordings /app/models /tmp/zelin-cache && \
touch /tmp/zelin-bot.log
ENV PORT=7860
ENV NODE_ENV=production
ENV MODEL_DIR=/app/models
EXPOSE 7860
HEALTHCHECK --interval=60s --timeout=10s --retries=3 \
CMD curl -f http://localhost:7860/health || exit 1
CMD ["bash", "/app/start.sh"]