File size: 958 Bytes
36ebfb6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Stage 1: Build Frontend
FROM node:20 as frontend-builder

WORKDIR /app/frontend
COPY techhubprototypeucfrontend/package*.json ./
RUN npm install
COPY techhubprototypeucfrontend/ .
RUN npm run build

# Stage 2: Backend
FROM python:3.11-slim

WORKDIR /app

# Install system dependencies if needed
# RUN apt-get update && apt-get install -y --no-install-recommends gcc && rm -rf /var/lib/apt/lists/*

COPY techhubprototypeucbackend/requirements.txt .
# Remove pyaudio from requirements if it's there, as it requires system dependencies and we removed usage
RUN sed -i '/pyaudio/d' requirements.txt

RUN pip install --no-cache-dir -r requirements.txt

COPY techhubprototypeucbackend/ .

# Copy frontend build to static folder
COPY --from=frontend-builder /app/frontend/dist ./static

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

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