Create Dockerfile
Browse files- Dockerfile +26 -0
Dockerfile
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Utiliser une image Ubuntu
|
| 2 |
+
FROM ubuntu:22.04
|
| 3 |
+
|
| 4 |
+
# Installer les dépendances de base
|
| 5 |
+
RUN apt update && apt install -y curl python3 python3-pip
|
| 6 |
+
|
| 7 |
+
# Installer Ollama
|
| 8 |
+
RUN curl -fsSL https://ollama.com/install.sh | sh
|
| 9 |
+
|
| 10 |
+
# Installer FastAPI et Uvicorn
|
| 11 |
+
RUN pip install fastapi uvicorn pydantic requests
|
| 12 |
+
|
| 13 |
+
# Télécharger un modèle IA léger (Mistral)
|
| 14 |
+
RUN ollama pull mistral
|
| 15 |
+
|
| 16 |
+
# Copier le code de l’API dans le conteneur
|
| 17 |
+
COPY app.py /app/app.py
|
| 18 |
+
|
| 19 |
+
# Définir le dossier de travail
|
| 20 |
+
WORKDIR /app
|
| 21 |
+
|
| 22 |
+
# Exposer le port pour Hugging Face Spaces
|
| 23 |
+
EXPOSE 7860
|
| 24 |
+
|
| 25 |
+
# Démarrer l’API FastAPI avec le bon port
|
| 26 |
+
CMD ["sh", "-c", "uvicorn app:app --host 0.0.0.0 --port ${PORT:-7860}"]
|