File size: 834 Bytes
b26ba8a
 
 
f821485
 
 
 
 
 
 
 
 
 
 
6e12dc7
b26ba8a
 
 
9171a17
b26ba8a
aa8fb88
f821485
 
 
aa8fb88
f821485
 
b26ba8a
f821485
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# 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"]