| FROM python:3.12-slim | |
| # Set working directory | |
| WORKDIR /app | |
| # Create data and logs directories with proper permissions | |
| # HuggingFace Spaces runs as non-root user, need proper permissions | |
| RUN mkdir -p /app/data /app/logs /app/app/static/css /app/app/static/js && \ | |
| chmod -R 777 /app/data /app/logs /app/app/static | |
| # Install dependencies | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy application code | |
| COPY . . | |
| # Set environment variables | |
| ENV DB_PATH=/app/data/tokens.db | |
| ENV LISTEN_PORT=7860 | |
| ENV SKIP_AUTH_TOKEN=true | |
| ENV ANONYMOUS_MODE=true | |
| # Expose HuggingFace Spaces default port | |
| EXPOSE 7860 | |
| # Run the application | |
| CMD ["python", "main.py"] | |