Spaces:
Sleeping
Sleeping
| # Multi-stage build: First build React app | |
| FROM node:18 as frontend-build | |
| WORKDIR /frontend | |
| COPY frontend/package*.json ./ | |
| RUN npm install | |
| COPY frontend/ ./ | |
| RUN npm run build | |
| # Use Python runtime for backend | |
| FROM python:3.10 | |
| WORKDIR /code | |
| COPY backend/requirements.txt /code/backend/requirements.txt | |
| RUN pip install --no-cache-dir --upgrade -r /code/backend/requirements.txt | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user | |
| ENV PATH=/home/user/.local/bin:$PATH | |
| WORKDIR $HOME/app | |
| # Copy backend | |
| COPY --chown=user backend/ $HOME/app/backend/ | |
| # Copy built React app to frontend directory | |
| COPY --from=frontend-build --chown=user /frontend/dist/ $HOME/app/frontend/ | |
| CMD ["uvicorn", "backend.app:app", "--host", "0.0.0.0", "--port", "7860"] |