File size: 1,703 Bytes
72be8d4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
FROM node:20-slim

# ── System deps ──────────────────────────────────────────────────────────────
RUN apt-get update && apt-get install -y --no-install-recommends \
    make g++ python3 curl wget ca-certificates \
    && rm -rf /var/lib/apt/lists/*

# ── CPU Performance ──────────────────────────────────────────────────────────
ENV NODE_OPTIONS="--max-old-space-size=6144"
ENV UV_THREADPOOL_SIZE=16

WORKDIR /app

# ── Install deps ─────────────────────────────────────────────────────────────
COPY package.json ./
RUN npm install --production 2>&1 | tail -5 || \
    npm install --legacy-peer-deps 2>&1 | tail -5 || true

# ── Copy app ─────────────────────────────────────────────────────────────────
COPY . .

# ── Model cache dir ──────────────────────────────────────────────────────────
RUN mkdir -p /app/models /tmp/worker-cache

ENV PORT=7860
ENV NODE_ENV=production
ENV MODEL_DIR=/app/models

EXPOSE 7860

HEALTHCHECK --interval=30s --timeout=10s --start-period=180s --retries=5 \
    CMD curl -f http://localhost:7860/health || exit 1

CMD ["node", "server.js"]