| # ============================================ | |
| # Dockerfile for Hugging Face Spaces | |
| # Education Presentation System with SSE | |
| # ============================================ | |
| FROM node:20-alpine | |
| # Install bash and curl | |
| RUN apk add --no-cache bash curl | |
| # Set working directory | |
| WORKDIR /app | |
| # Install bun | |
| RUN npm install -g bun | |
| # Copy package files | |
| COPY package.json bunfig.toml ./ | |
| # Install dependencies | |
| RUN bun install --frozen-lockfile | |
| # Copy source code | |
| COPY . . | |
| # Build Next.js app | |
| RUN bun run build | |
| # Create necessary directories | |
| RUN mkdir -p /app/data | |
| # HF Spaces configuration | |
| ENV PORT=7860 | |
| ENV HOST=0.0.0.0 | |
| ENV NODE_ENV=production | |
| # Expose port (HF Spaces uses 7860) | |
| EXPOSE 7860 | |
| # Health check | |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \ | |
| CMD curl -f http://localhost:7860/ || exit 1 | |
| # Copy and setup start script | |
| COPY start.sh /start.sh | |
| RUN chmod +x /start.sh && sed -i 's/\r$//' /start.sh | |
| CMD ["/start.sh"] | |