Spaces:
Sleeping
Sleeping
File size: 848 Bytes
04f25f0 7267617 04f25f0 |
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:22-alpine as frontend-build
WORKDIR /app/frontend
COPY frontend/package*.json ./
RUN npm install
COPY frontend/ ./
RUN npm run build
# Stage 2: Build Backend and Final Image
FROM python:3.10-slim
WORKDIR /app
# Install system dependencies if any (e.g. for some pip packages)
# RUN apt-get update && apt-get install -y gcc
# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy backend code
COPY backend/ ./backend/
# Copy built frontend from Stage 1
COPY --from=frontend-build /app/frontend/dist ./frontend/dist
# Expose the correct port for Hugging Face Spaces
EXPOSE 7860
# Command to run the application
# We use host 0.0.0.0 and port 7860 (required by HF Spaces)
CMD ["uvicorn", "backend.app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|