| # ββ Customer Support Inbox β OpenEnv ββββββββββββββββββββββββββββββββββββββββββ | |
| # Hugging Face Spaces compatible Docker image. | |
| # Port: 7860 (HF Spaces default) | |
| # Build: docker build -t cs-inbox-env . | |
| # Run: docker run -p 7860:7860 -e HF_TOKEN=<key> cs-inbox-env | |
| FROM python:3.11-slim | |
| # Metadata | |
| LABEL maintainer="OpenEnv Customer Support Inbox" | |
| LABEL description="Real-world customer support inbox simulation for agent training" | |
| LABEL version="1.0.0" | |
| # Set environment | |
| ENV PYTHONDONTWRITEBYTECODE=1 \ | |
| PYTHONUNBUFFERED=1 \ | |
| PORT=7860 \ | |
| MODEL_NAME=gpt-4o-mini \ | |
| API_BASE_URL=https://api.openai.com/v1 | |
| # System dependencies | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| curl \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create non-root user (HF Spaces requirement) | |
| RUN useradd -m -u 1000 appuser | |
| # Working directory | |
| WORKDIR /app | |
| # Install Python dependencies | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy application code | |
| COPY environment/ ./environment/ | |
| COPY app.py . | |
| COPY inference.py . | |
| COPY openenv.yaml . | |
| # Set ownership | |
| RUN chown -R appuser:appuser /app | |
| USER appuser | |
| # Health check | |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=15s --retries=3 \ | |
| CMD curl -f http://localhost:${PORT}/health || exit 1 | |
| # Expose port | |
| EXPOSE ${PORT} | |
| # Start FastAPI server | |
| CMD ["python", "-m", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"] | |