Spaces:
Sleeping
Sleeping
| # Utiliser l'image officielle d'Ollama comme base | |
| FROM ollama/ollama | |
| # Installer Python et pip | |
| RUN apt-get update && apt-get install -y python3 python3-pip | |
| # Copier les fichiers de l'application | |
| COPY app.py /app/app.py | |
| COPY requirements.txt /app/requirements.txt | |
| # Installer les dépendances Python | |
| RUN pip3 install -r /app/requirements.txt | |
| # Exposer le port 7860 pour FastAPI | |
| EXPOSE 11434 | |
| # Définir le volume pour les données d'Ollama | |
| VOLUME /root/.ollama | |
| # Installer socat pour rediriger le port | |
| # Script pour lancer Ollama, télécharger le modèle et démarrer l'application FastAPI | |
| RUN echo '#!/bin/sh\n\ | |
| ollama serve &\n\ | |
| sleep 10\n\ | |
| ollama pull llama3\n\ | |
| python3 /app/app.py\n\ | |
| ' > /run-ollama-fastapi.sh && chmod +x /run-ollama-fastapi.sh | |
| # Définir le point d'entrée | |
| ENTRYPOINT ["/bin/sh", "/run-ollama-fastapi.sh"] |