-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
64 lines (49 loc) · 2.21 KB
/
Dockerfile
File metadata and controls
64 lines (49 loc) · 2.21 KB
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
57
58
59
60
61
62
63
64
# Simple, production-ready Dockerfile for Educational API on EC2
# Pass environment variables at runtime (not baked into image)
FROM python:3.11-slim
# Prevent Python from writing .pyc files & enable unbuffered logs
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1
WORKDIR /app
# Install system dependencies (PostgreSQL client libraries + build tools)
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
gcc \
libpq-dev \
curl \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements file FIRST (for Docker layer caching)
COPY requirements-minimal2.txt /app/requirements.txt
# Fix potential Windows CRLF line endings
RUN sed -i 's/\r$//' /app/requirements.txt
# Copy project configuration
COPY pyproject.toml /app/pyproject.toml
# Upgrade pip and install dependencies
RUN python -m pip install --upgrade pip setuptools wheel && \
pip install --no-cache-dir uv==0.4.21 && \
uv pip install --system --no-cache -vvv -r /app/requirements.txt
# Copy application code
COPY utils/ /app/utils/
COPY tester_agent/ /app/tester_agent/
COPY revision_agent/ /app/revision_agent/
COPY educational_agent_optimized_langsmith_autosuggestion/ /app/educational_agent_optimized_langsmith_autosuggestion/
COPY educational_agent_optimized_langsmith_v5/ /app/educational_agent_optimized_langsmith_v5/
COPY autosuggestion/ /app/autosuggestion/
COPY concept_map_poc/ /app/concept_map_poc/
COPY simulation_to_concept/ /app/simulation_to_concept/
COPY api_tracker_utils/ /app/api_tracker_utils/
COPY api_servers/ /app/api_servers/
COPY science_jsons/ /app/science_jsons/
COPY NCERT/ /app/NCERT/
# Install project in editable mode (makes all modules importable)
RUN pip install --no-cache-dir -e .
# DO NOT copy .env file into image (pass secrets at runtime)
# Expose API port (documentation only)
EXPOSE 8000
# Set environment variable to skip table setup (tables must already exist)
ENV SKIP_POSTGRES_SETUP=true
# Run FastAPI server
# IMPORTANT: For Transaction Mode (port 6543), ensure tables are created beforehand
# Environment variables will be passed at runtime via docker run -e or --env-file
CMD ["uvicorn", "api_servers.api_server_v5:app", "--host", "0.0.0.0", "--port", "8000"]