File size: 1,394 Bytes
434174b 819261f 434174b 9fe20fc 434174b 9fe20fc 434174b 80631d4 6736d12 80631d4 434174b | 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 | # Stage 1: Build the frontend
FROM node:20 AS frontend-builder
WORKDIR /app/frontend
COPY frontend/package*.json ./
RUN npm install
COPY frontend/ ./
RUN npm run build
# Stage 2: Setup the backend and serve
FROM python:3.10-slim
WORKDIR /app/backend
# Install system dependencies that might be required by ML libraries like lightgbm or xgboost
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libgomp1 \
&& rm -rf /var/lib/apt/lists/*
# Install backend dependencies
COPY backend/requirements.txt ./
RUN pip install --no-cache-dir --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
# Install huggingface_hub for python (if not in requirements, good to have)
RUN pip install --no-cache-dir huggingface-hub
# Copy backend code
COPY backend/ ./
# Generate the data and pre-trained models natively inside the container
# to avoid Python 3.10 vs 3.13 pickle serialization incompatibilities
RUN python data_generator.py && python model_pipeline.py --source combined
# Copy built frontend to backend/static
COPY --from=frontend-builder /app/frontend/dist ./static
# Ensure data directory exists and generator can run or uses existing csv
# (The dataset is in backend/data/synthetic_students.csv)
EXPOSE 7860
ENV HOST=0.0.0.0
ENV PORT=7860
ENV PYTHONUNBUFFERED=1
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|