File size: 3,168 Bytes
753b5ee
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82f2af5
 
753b5ee
 
 
 
 
ed7afa9
753b5ee
ed7afa9
 
753b5ee
 
 
 
 
ed7afa9
 
 
753b5ee
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# ──────────────────────────────────────────────────────────────
# Official Meta Γ— PyTorch OpenEnv base image
#   β€’ Python 3.11.15 pre-installed
#   β€’ FastAPI + uvicorn pre-installed
#   β€’ WORKDIR /app, PYTHONUNBUFFERED=1, UV_SYSTEM_PYTHON=1 set
#   β€’ Uses uv as the fast package manager
# ──────────────────────────────────────────────────────────────
FROM ghcr.io/meta-pytorch/openenv-base:latest

# ── System dependencies (curl for HEALTHCHECK) ────────────────
RUN apt-get update && apt-get install -y --no-install-recommends \
    curl \
    && rm -rf /var/lib/apt/lists/*

# ── Python path: include both /app and /app/src ───────────────
# Base image sets PYTHONPATH=/app/src; we extend it so the
# top-level package (email_triage_rl_hackathon/) is importable
# whether running from /app or /app/src.
ENV PYTHONPATH=/app:/app/src

# ── Enable the built-in OpenEnv web inspector UI ──────────────
# Set to "false" to disable the Swagger/ReDoc interface.
ENV ENABLE_WEB_INTERFACE=true

# ── Runtime config ────────────────────────────────────────────
# Do NOT set TASK_LEVEL β€” inference.py must run all 3 levels for the validator.
# The uvicorn server reads TASK_LEVEL at request time; leaving it unset is fine.
ENV PORT=7860

# ── Install only what the base image does NOT already provide ─
# openenv-core is not pre-installed in the base image.
# fastapi + uvicorn are already present β€” uv skips them.
# openai + python-dotenv are needed by inference.py.
COPY email_triage_rl_hackathon/server/requirements.txt ./requirements.txt
RUN uv pip install --no-cache -r requirements.txt && \
    uv pip install --no-cache openai python-dotenv

# ── Copy package source and install it ────────────────────────
COPY email_triage_rl_hackathon/ ./email_triage_rl_hackathon/
RUN uv pip install --no-cache ./email_triage_rl_hackathon/

# ── Copy inference script ──────────────────────────────────────
COPY inference.py ./inference.py

# ── Runtime output directories ────────────────────────────────
RUN mkdir -p email_triage_rl_hackathon/outputs/logs \
             email_triage_rl_hackathon/outputs/evals

EXPOSE 7860

# ── Health check ──────────────────────────────────────────────
HEALTHCHECK --interval=30s --timeout=10s --start-period=15s --retries=3 \
    CMD curl -f http://localhost:${PORT}/health || exit 1

CMD ["sh", "-c", "uvicorn email_triage_rl_hackathon.server.app:app --host 0.0.0.0 --port ${PORT}"]