From 6c9c3f663b7162527baf0affedbd5b4bfb0e14bc Mon Sep 17 00:00:00 2001 From: cangui Date: Sat, 16 Aug 2025 16:26:36 +0200 Subject: [PATCH] first --- Dockerfile | 30 ++++++++++++++++++++++++++++++ docker-compose.yml | 18 ++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..32aaa3d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,30 @@ +FROM quay.io/go-skynet/local-ai:latest + +ENV MODELS_PATH=/models \ + DEBUG=false \ + THREADS=2 \ + CONTEXT_SIZE=1024 + +# Crée le dossier des modèles +RUN mkdir -p /models + +# Télécharge un **petit modèle chat** (TinyLlama 1.1B, quantisé Q4) au **build** +# -> Il sera **embarqué** dans l'image finale. Aucune connexion réseau n'est +# nécessaire **à l'exécution**. +RUN curl -L --fail --progress-bar \ + -o /models/tinyllama-1.1b-chat.Q4_K_M.gguf \ + https://huggingface.co/TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF/resolve/main/tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf + +# Mappe le nom du modèle **gpt-oss-20b** (compat) vers le fichier téléchargé +# => côté Symfony on référence simplement "gpt-oss-20b" +RUN printf "name: gpt-oss-20b +backend: llama +parameters: + model: tinyllama-1.1b-chat.Q4_K_M.gguf + n_ctx: %s + n_threads: %s + temperature: 0.2 + top_p: 0.9 +" "$CONTEXT_SIZE" "$THREADS" > /models/gpt-oss-20b.yaml + +# L'entrée du serveur (déjà gérée par docker-compose via `command`) \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..8288d39 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,18 @@ +version: "3.9" +services: + localai: + build: . + container_name: localai + ports: + - "8080:8080" + environment: + - MODELS_PATH=/models + - THREADS=2 # ajustez selon vos cores (léger par défaut) + - CONTEXT_SIZE=1024 # contexte réduit pour tests + - DEBUG=false + command: ["--models-path", "/models", "--address", "0.0.0.0:8080"] + healthcheck: + test: ["CMD", "curl", "-fsS", "http://localhost:8080/v1/models"] + interval: 10s + timeout: 5s + retries: 10 \ No newline at end of file