aegis-fraud-detector / Dockerfile
WizardCoder2007's picture
Fresh deploy with clean history
31b612e
Raw
History Blame Contribute Delete
1.09 kB
# Stage 1: Build the React static frontend
FROM node:20-alpine AS frontend-builder
WORKDIR /app/frontend
# Copy dependencies list and install
COPY frontend/package*.json ./
RUN npm install
# Copy source code and build
COPY frontend/ ./
RUN npm run build
# Stage 2: Create the production Python environment
FROM python:3.12-slim
WORKDIR /app
# Install system utilities if needed (lightweight slim image)
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Copy backend requirements and install
COPY backend/requirements.txt ./backend/requirements.txt
RUN pip install --no-cache-dir -r backend/requirements.txt
# Copy model artifacts
COPY model_artifacts/ ./model_artifacts/
# Copy backend code
COPY backend/ ./backend/
# Copy built frontend assets from Stage 1 into FastAPI's static folder
COPY --from=frontend-builder /app/frontend/dist ./backend/static
# Expose the default Hugging Face Space port
EXPOSE 7860
# Run FastAPI app
CMD ["uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "7860"]