File size: 909 Bytes
a172898
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e070e39
4417a9e
a172898
 
4417a9e
a172898
 
 
 
 
 
 
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
FROM python:3.11-slim

WORKDIR /app

# Install Node.js for frontend build
RUN apt-get update && apt-get install -y curl && \
    curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
    apt-get install -y nodejs && \
    apt-get clean && rm -rf /var/lib/apt/lists/*

# Install uv
RUN pip install uv

# Copy Python dependencies
COPY pyproject.toml uv.lock* ./
RUN uv sync --frozen || uv sync

# Copy frontend and build
COPY frontend/ ./frontend/
WORKDIR /app/frontend
RUN npm ci && npm run build

# Copy backend
WORKDIR /app
COPY backend/ ./backend/

# Create data directory for SQLite and set permissions
RUN mkdir -p /app/data && chmod 777 /app/data

# Set environment variables
ENV DATABASE_URL=sqlite+aiosqlite:///app/data/algebra_chat.db
ENV PYTHONPATH=/app

# Expose port
EXPOSE 7860

# Run the application
CMD ["uv", "run", "uvicorn", "backend.app:app", "--host", "0.0.0.0", "--port", "7860"]