CADDEO1 / Dockerfile
loaai-rashad
Add Hugging Face Spaces deploy config (free hosting)
f709dcb
Raw
History Blame Contribute Delete
1.01 kB
# DevisionX progress-tracking tool — single image: React build + FastAPI API.
# ---- stage 1: build the React frontend ----
FROM node:22-slim AS frontend
WORKDIR /fe
COPY demo1-physical-cad/frontend/package.json demo1-physical-cad/frontend/package-lock.json ./
RUN npm ci
COPY demo1-physical-cad/frontend/ ./
RUN npm run build
# ---- stage 2: python runtime serving API + built frontend ----
FROM python:3.11-slim
WORKDIR /app
COPY demo1-physical-cad/backend/requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY demo1-physical-cad/backend/ ./
# built SPA -> ./static (served by app.py when present)
COPY --from=frontend /fe/dist ./static
# uploads + SQLite live here; mount a persistent disk at /data in the cloud.
# world-writable so it works whether the host runs the container as root or a
# non-root user (e.g. Hugging Face Spaces).
ENV LIVE_DATA_DIR=/data
RUN mkdir -p /data && chmod 777 /data
EXPOSE 8000
CMD ["sh", "-c", "uvicorn app:app --host 0.0.0.0 --port ${PORT:-8000}"]