mirror of
https://github.com/R0m1k3/Loki.git
synced 2026-10-11 17:26:57 +02:00
48 lines
1.7 KiB
Docker
48 lines
1.7 KiB
Docker
# ── Étape 1 : build du frontend ─────────────────────────────────────────
|
|
FROM node:20-alpine AS frontend
|
|
WORKDIR /app/frontend
|
|
COPY frontend/package.json frontend/package-lock.json* ./
|
|
RUN npm install
|
|
COPY frontend/ ./
|
|
RUN npm run build
|
|
|
|
# ── Étape 2 : runtime backend (sert aussi le front statique) ────────────
|
|
FROM python:3.12-slim AS runtime
|
|
WORKDIR /app
|
|
|
|
ENV PYTHONUNBUFFERED=1 \
|
|
PYTHONDONTWRITEBYTECODE=1 \
|
|
WORKSPACE_DIR=/workspace \
|
|
DATA_DIR=/data \
|
|
PORT=8717
|
|
|
|
# curl pour le HEALTHCHECK ; git pour le moteur code (commits Aider) ;
|
|
# nodejs/npm pour les serveurs MCP lancés via npx (Playwright, Context7…)
|
|
RUN apt-get update && apt-get install -y --no-install-recommends curl git nodejs npm \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY backend/requirements.txt ./
|
|
RUN pip install --no-cache-dir -r requirements.txt mcp-server-fetch
|
|
|
|
COPY backend/ ./backend/
|
|
# Frontend compilé servi en statique par FastAPI
|
|
COPY --from=frontend /app/frontend/dist ./backend/static
|
|
|
|
RUN mkdir -p /workspace /data
|
|
|
|
# Marqueur de version (git sha court), injecté par le workflow de build.
|
|
ARG LOKI_VERSION=dev
|
|
ENV LOKI_VERSION=${LOKI_VERSION}
|
|
|
|
# NB : on tourne en root par défaut pour rester compatible avec les volumes
|
|
# montés d'Unraid (/mnt/user/appdata/...), souvent détenus par root. Pour
|
|
# durcir, surcharge l'utilisateur côté compose (ex. user: "99:100").
|
|
|
|
EXPOSE 8717
|
|
WORKDIR /app/backend
|
|
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
|
|
CMD curl -fsS "http://localhost:${PORT}/api/health" || exit 1
|
|
|
|
CMD ["sh", "-c", "uvicorn app.main:app --host 0.0.0.0 --port ${PORT}"]
|