Spaces:
Sleeping
Sleeping
| # ============================================================ | |
| # HangOut Main Backend — Single File Edition | |
| # Hugging Face Docker Space (mobile-deploy friendly) | |
| # ============================================================ | |
| # Bas 3 files chahiye: server.js, package.json, Dockerfile | |
| # Koi src/ folder nahi, koi nested structure nahi. | |
| # ============================================================ | |
| FROM node:20-slim | |
| # Install curl for healthchecks | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| curl \ | |
| && rm -rf /var/lib/apt/lists/* | |
| WORKDIR /app | |
| # Copy package files first (better layer caching) | |
| COPY package.json package-lock.json* ./ | |
| # Install production dependencies only | |
| RUN npm install --only=production --no-audit --no-fund | |
| # Copy the SINGLE server file (no src/ folder) | |
| COPY server.js ./ | |
| # Hugging Face Space uses port 7860 by default | |
| ENV PORT=7860 | |
| ENV HOST=0.0.0.0 | |
| ENV NODE_ENV=production | |
| EXPOSE 7860 | |
| # Healthcheck — service responds with 200 on /health | |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=20s --retries=3 \ | |
| CMD curl -f http://localhost:7860/health || exit 1 | |
| # Non-root user for security | |
| USER node | |
| # Start the service (single file!) | |
| CMD ["node", "server.js"] | |