Spaces:
Sleeping
Sleeping
File size: 865 Bytes
481234c |
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 |
# Build Stage for Frontend
FROM node:20-slim AS frontend-build
WORKDIR /app/frontend
COPY frontend/package*.json ./
RUN npm install
COPY frontend/ .
RUN npm run build
# Final Stage for Backend and Serving
FROM python:3.11-slim
WORKDIR /app
# Install system dependencies if needed
RUN apt-get update && apt-get install -y \
build-essential \
&& 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 app.py .
COPY main.py .
# Copy frontend build from previous stage
COPY --from=frontend-build /app/frontend/dist ./frontend/dist
# Expose the port (Hugging Face Spaces use 7860 by default)
EXPOSE 7860
# Command to run the application
# We use 0.0.0.0 to allow external connections
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|