File size: 1,287 Bytes
af0538f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8e4bb54
 
af0538f
 
 
 
 
 
 
 
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
# Use an official Python runtime as a parent image
# Slim version is smaller but full version prevents some build issues with large ML libs
FROM python:3.10-slim

# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1

# Set work directory
WORKDIR /app

# Install system dependencies (needed for some python packages)
RUN apt-get update && apt-get install -y \
    build-essential \
    curl \
    && rm -rf /var/lib/apt/lists/*

# Install Python dependencies
RUN pip install --no-cache-dir --upgrade pip
COPY backend/requirements.txt /app/backend/requirements.txt
RUN pip install --no-cache-dir -r /app/backend/requirements.txt
# PyTroch CPU-only
RUN pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu

# Download NLTK data (VADER lexicon) during build so we don't download at runtime
RUN python -c "import nltk; nltk.download('vader_lexicon')"

# Copy the code
COPY backend/ /app/backend/
COPY frontend/ /app/frontend/
# Root-level entry points required by the OpenEnv grader
COPY inference.py /app/inference.py

# Expose the port
EXPOSE 8000

# Run the application
# We use /app/backend as part of pythonpath to find modules
ENV PYTHONPATH=/app/backend
CMD ["uvicorn", "backend.app:app", "--host", "0.0.0.0", "--port", "8000"]