File size: 848 Bytes
2ed7fce
05b574c
 
2ed7fce
 
05b574c
2ed7fce
05b574c
 
2ed7fce
 
 
05b574c
2ed7fce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Use Python 3.9 base
FROM python:3.9

# Install Node.js & npm (for building React)
RUN apt-get update && apt-get install -y nodejs npm

# Create a working directory
WORKDIR /app

# Copy requirements and install Python deps
COPY requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt

# Copy the entire project
COPY . /app

# Build the frontend
WORKDIR /app/frontend
RUN npm install
RUN npm run build

# Move the built frontend into the backend static folder
WORKDIR /app
RUN cp -R /app/frontend/build /app/backend/static

# Expose port 7860 (Hugging Face Spaces default)
EXPOSE 7860

# Set environment variables
ENV PORT 7860
ENV HOST 0.0.0.0

# Switch to the backend directory
WORKDIR /app/backend

# Run the FastAPI application
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]