sushilideaclan01's picture
first commit
390c25a
raw
history blame contribute delete
882 Bytes
# Multi-stage: build frontend, then run FastAPI + static frontend
# Hugging Face Spaces: set DATA_DIR=/tmp/amalfa-data (only /tmp is writable), port 7860
# --- Frontend build ---
FROM node:20-alpine AS frontend
WORKDIR /app/frontend
COPY frontend/package.json frontend/package-lock.json* ./
RUN npm ci
COPY frontend/ ./
RUN npm run build
# --- Backend + serve static ---
FROM python:3.12-slim
WORKDIR /app
# Backend deps
COPY backend/requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# Backend code
COPY backend/ ./
# Frontend build → app/static so FastAPI can serve it
COPY --from=frontend /app/frontend/dist ./app/static
# Hugging Face: writable dir (only /tmp is persistent)
ENV DATA_DIR=/tmp/amalfa-data
ENV PORT=7860
EXPOSE 7860
# Run from backend dir so `app` package resolves
WORKDIR /app
CMD uvicorn app.main:app --host 0.0.0.0 --port ${PORT}