| |
| FROM node:20-alpine AS frontend-builder |
|
|
| WORKDIR /app/client |
|
|
| COPY client/package*.json ./ |
| RUN npm ci |
|
|
| COPY client ./ |
| RUN npm run build |
|
|
|
|
| |
| FROM python:3.11-slim AS runtime |
|
|
| ENV PYTHONDONTWRITEBYTECODE=1 \ |
| PYTHONUNBUFFERED=1 \ |
| PORT=7860 |
|
|
| WORKDIR /app |
|
|
| RUN apt-get update && apt-get install -y --no-install-recommends \ |
| build-essential \ |
| libgl1 \ |
| libglib2.0-0 \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| COPY requirements.txt . |
| RUN pip install --upgrade pip setuptools wheel \ |
| && pip install -r requirements.txt |
|
|
| COPY backend ./backend |
| COPY data ./data |
|
|
| |
| COPY --from=frontend-builder /app/frontend ./frontend |
|
|
| |
| RUN useradd -m appuser && chown -R appuser:appuser /app |
| USER appuser |
|
|
| EXPOSE 7860 |
|
|
| CMD ["sh", "-c", "uvicorn backend.app:app --host 0.0.0.0 --port ${PORT}"] |