Spaces:
Sleeping
Sleeping
File size: 1,295 Bytes
8bb4efc 8d6d081 8bb4efc 051f287 8bb4efc 051f287 | 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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | # Build the React frontend first
FROM node:20-alpine AS frontend-builder
WORKDIR /frontend
ARG VITE_SUPABASE_URL
ARG VITE_SUPABASE_ANON_KEY
ARG VITE_API_URL
ENV VITE_SUPABASE_URL=${VITE_SUPABASE_URL}
ENV VITE_SUPABASE_ANON_KEY=${VITE_SUPABASE_ANON_KEY}
ENV VITE_API_URL=${VITE_API_URL}
COPY Frontend/package*.json ./
RUN npm ci
COPY Frontend/ ./
RUN npm run build
# Use official Python image for the runtime
FROM python:3.11-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PORT=7860
# Set work directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
libpoppler-cpp-dev \
libmagic1 \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements
COPY Backend/requirements.txt ./requirements.txt
# Install Python dependencies
RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt
# Copy backend code
COPY Backend/ .
# Copy built frontend assets into the Flask app container
COPY --from=frontend-builder /frontend/dist ./frontend_dist
# Expose port for Hugging Face Spaces
EXPOSE 7860
# Set environment for Flask
ENV FLASK_APP=app.py
ENV FLASK_RUN_HOST=0.0.0.0
ENV FLASK_RUN_PORT=7860
# Run the app
CMD ["flask", "run"]
|