Spaces:
Paused
Paused
| # ╔══════════════════════════════════════════════════════╗ | |
| # Stage 1 — Builder: تثبيت وبناء كل الـ native modules | |
| # ╚══════════════════════════════════════════════════════╝ | |
| FROM node:20-slim AS builder | |
| WORKDIR /app | |
| # build tools لـ node-gyp + native modules (mineflayer, pathfinder) | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| python3 make g++ gcc \ | |
| && rm -rf /var/lib/apt/lists/* | |
| COPY package.json ./ | |
| RUN npm install --production --no-optional | |
| # ╔══════════════════════════════════════════════════════╗ | |
| # Stage 2 — Final: image نظيفة بدون build tools | |
| # ╚══════════════════════════════════════════════════════╝ | |
| FROM node:20-slim | |
| WORKDIR /app | |
| # فقط curl و dnsutils للـ healthcheck والشبكة | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| curl dnsutils \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # node:20-slim جاي بـ user "node" بـ UID 1000 تلقائياً | |
| RUN chown -R node:node /app | |
| # ننقل node_modules المبنية من الـ builder بس | |
| COPY --from=builder --chown=node:node /app/node_modules ./node_modules | |
| COPY --chown=node:node package.json ./ | |
| COPY --chown=node:node bot-team.js ./ | |
| COPY --chown=node:node aternos-starter.js ./ | |
| USER node | |
| EXPOSE 7860 | |
| ENV PORT=7860 | |
| ENV NODE_ENV=production | |
| ENV NODE_OPTIONS="--max-old-space-size=450" | |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=40s \ | |
| CMD curl -sf http://localhost:7860/healthz | grep -q '"status":"ok"' || exit 1 | |
| CMD ["node", "--max-old-space-size=450", "bot-team.js"] | |