| FROM node:20-slim | |
| WORKDIR /app | |
| # build-deps (node-gyp toolchain) + runtime tools for bucket sync: | |
| # - python3 + huggingface_hub: HF Dataset push/pull | |
| # - sqlite3: safe online snapshot via `.backup` | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| ca-certificates \ | |
| git \ | |
| python3 \ | |
| python3-pip \ | |
| sqlite3 \ | |
| make \ | |
| g++ \ | |
| && rm -rf /var/lib/apt/lists/* | |
| RUN pip install --no-cache-dir --break-system-packages "huggingface_hub[cli]>=1.15.0" | |
| RUN git clone https://github.com/decolua/9router.git . | |
| RUN npm install --legacy-peer-deps | |
| RUN npm run build | |
| # Keep sync scripts outside /app/ so they survive any app-level cleanup | |
| # and aren't picked up by the build's file scanners. | |
| COPY start.sh backup.sh /opt/9router-sync/ | |
| RUN sed -i 's/\r$//' /opt/9router-sync/start.sh /opt/9router-sync/backup.sh \ | |
| && chmod 0755 /opt/9router-sync/start.sh /opt/9router-sync/backup.sh | |
| ENV PORT=7860 | |
| ENV HOSTNAME=0.0.0.0 | |
| ENV NODE_ENV=production | |
| ENV DATA_DIR=/app/data | |
| EXPOSE 7860 | |
| CMD ["/opt/9router-sync/start.sh"] | |