| FROM node:20-alpine AS frontend-builder | |
| WORKDIR /workspace | |
| COPY app/frontend/package*.json ./app/frontend/ | |
| RUN cd app/frontend && npm ci | |
| COPY app/frontend ./app/frontend | |
| RUN cd app/frontend && npm run build | |
| FROM python:3.11-slim AS runtime | |
| ENV PYTHONDONTWRITEBYTECODE=1 \ | |
| PYTHONUNBUFFERED=1 \ | |
| PORT=7860 \ | |
| DEMO_MODE=true | |
| WORKDIR /workspace | |
| RUN adduser --disabled-password --gecos "" --uid 1000 appuser | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| COPY start.sh . | |
| COPY app/backend ./app/backend | |
| COPY app/data ./app/data | |
| COPY app/public ./app/public | |
| COPY --from=frontend-builder /workspace/app/frontend/dist ./app/frontend/dist | |
| RUN chmod +x /workspace/start.sh && chown -R 1000:1000 /workspace | |
| USER 1000 | |
| EXPOSE 7860 | |
| CMD ["/workspace/start.sh"] | |