|
|
|
|
|
FROM node:20-alpine AS frontend |
|
|
|
|
|
WORKDIR /app/frontend |
|
|
|
|
|
|
|
|
COPY frontend/package*.json ./ |
|
|
COPY frontend/package-lock.json ./ |
|
|
RUN npm install --frozen-lockfile |
|
|
|
|
|
|
|
|
COPY frontend/ ./ |
|
|
RUN npm run build |
|
|
|
|
|
|
|
|
FROM python:3.10-slim AS backend |
|
|
|
|
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive \ |
|
|
PYTHONDONTWRITEBYTECODE=1 \ |
|
|
PYTHONUNBUFFERED=1 \ |
|
|
PIP_NO_CACHE_DIR=1 \ |
|
|
HF_HOME=/app/.cache/huggingface |
|
|
|
|
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \ |
|
|
git curl && \ |
|
|
rm -rf /var/lib/apt/lists/* |
|
|
|
|
|
|
|
|
RUN useradd -m appuser |
|
|
|
|
|
|
|
|
RUN mkdir -p /app/.cache/huggingface \ |
|
|
&& mkdir -p /app/static \ |
|
|
&& chown -R appuser:appuser /app |
|
|
|
|
|
|
|
|
USER appuser |
|
|
|
|
|
WORKDIR /app |
|
|
|
|
|
|
|
|
COPY backend/requirements.txt /app/backend/requirements.txt |
|
|
RUN python3 -m pip install --upgrade pip && \ |
|
|
python3 -m pip install -r /app/backend/requirements.txt |
|
|
|
|
|
|
|
|
COPY backend/ /app/backend/ |
|
|
|
|
|
|
|
|
COPY --from=frontend /app/frontend/dist/ /app/static/ |
|
|
|
|
|
|
|
|
ENV STATIC_DIR=/app/static \ |
|
|
MODEL_ID=FractalAIResearch/Fathom-R1-14B \ |
|
|
PIPELINE_TASK=text-generation \ |
|
|
QUANTIZE=auto |
|
|
|
|
|
|
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \ |
|
|
CMD curl -f http://localhost:8000/health || exit 1 |
|
|
|
|
|
|
|
|
EXPOSE 7860 |
|
|
ENTRYPOINT ["python3", "-m", "uvicorn", "app.main:app", "--app-dir", "/app/backend", "--host", "0.0.0.0", "--port", "7860"] |