File size: 863 Bytes
d184dfc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
310b4ae
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
FROM python:3.9-slim

WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y \
    build-essential \
    nodejs \
    npm \
    && rm -rf /var/lib/apt/lists/*

# Install Python dependencies
COPY backend/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy frontend source and install dependencies
COPY frontend/ ./frontend/
WORKDIR /app/frontend
RUN npm install
RUN npm run build

# Copy backend source
WORKDIR /app
COPY backend/ .

# Install serve to run the frontend
RUN npm install -g serve

# Expose the port (Hugging Face requires 7860)
EXPOSE 7860

# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV PORT=7860
ENV REACT_APP_API_URL=https://shipmaster1-pythonicragreact.hf.space

# Start both services
CMD ["sh", "-c", "serve -s frontend/build -l 7860 & uvicorn main:app --host 0.0.0.0 --port 7860"]