File size: 1,038 Bytes
023bfdf
 
 
 
 
5e17409
 
023bfdf
cede57b
023bfdf
 
 
6fa9ca8
 
 
 
cede57b
 
023bfdf
 
 
 
6fa9ca8
023bfdf
 
6fa9ca8
 
023bfdf
6fa9ca8
 
023bfdf
 
 
cede57b
023bfdf
 
cede57b
 
e58ef37
cede57b
4128af1
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
# Build stage for React frontend
FROM node:20-slim as build-frontend

WORKDIR /app/frontend
COPY frontend/package*.json ./
# Use --legacy-peer-deps to handle conflicts between React 19 and lucide-react
RUN npm ci --legacy-peer-deps || npm install --legacy-peer-deps
COPY frontend/ ./
# Run build, ensuring we see errors if they occur
RUN npm run build

# Final stage
FROM python:3.11-slim

WORKDIR /app

# Install system dependencies
# Combine into one layer and cleanup to keep image small
RUN apt-get update && apt-get install -y \
    build-essential \
    curl \
    && rm -rf /var/lib/apt/lists/*

# Copy requirements and install
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy backend code
COPY . .

# Copy built frontend from stage 1
COPY --from=build-frontend /app/frontend/dist ./frontend/dist

# Expose port
EXPOSE 7860

# Set environment variables
ENV PYTHONUNBUFFERED=1

# Command to run the application
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--loop", "asyncio"]