deployment
This commit is contained in:
28
.gitea/workflows/deploy.yml
Normal file
28
.gitea/workflows/deploy.yml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
name: Deploy-Test-API
|
||||||
|
run-name: ${{ gitea.actor }} is deploying the test API 🚀
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
target_env:
|
||||||
|
description: 'Environnement de destination'
|
||||||
|
required: true
|
||||||
|
default: 'production'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
Deploy-To-VM:
|
||||||
|
# On demande à notre Runner Ubuntu de s'en occuper
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Vérification du statut
|
||||||
|
run: echo "Déploiement initié par ${{ gitea.actor }}."
|
||||||
|
|
||||||
|
# On utilise directement la commande Docker de la VM hôte pour reconstruire et relancer
|
||||||
|
- name: Rebuild & Restart Test API
|
||||||
|
run: |
|
||||||
|
cd /home/ubuntu/n8n-stack
|
||||||
|
docker compose build test-api
|
||||||
|
docker compose up -d --no-deps test-api
|
||||||
|
|
||||||
|
- name: Succès
|
||||||
|
run: echo "API redéployée avec succès !"
|
||||||
22
Dockerfile
Normal file
22
Dockerfile
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# 1. On part d'une image Python légère
|
||||||
|
FROM python:3.11-slim
|
||||||
|
|
||||||
|
# 2. On définit le dossier de travail dans le conteneur
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# 3. On installe les dépendances système (pour Postgres/Valkey si besoin)
|
||||||
|
RUN apt-get update && apt-get install -y libpq-dev gcc && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# 4. On copie et on installe les dépendances Python
|
||||||
|
COPY requirements.txt .
|
||||||
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
|
# 5. On copie tout ton code (dont main.py) dans le conteneur
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# 6. On expose le port sur lequel FastAPI va tourner
|
||||||
|
EXPOSE 9000
|
||||||
|
|
||||||
|
# 7. LA COMMANDE CRUCIALE : On lance le serveur Uvicorn
|
||||||
|
# On dit à Uvicorn de chercher l'objet "app" dans le fichier "main"
|
||||||
|
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "9000"]
|
||||||
5
requirements.txt
Normal file
5
requirements.txt
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
fastapi
|
||||||
|
uvicorn
|
||||||
|
langchain-google-genai
|
||||||
|
langgraph
|
||||||
|
# Ajoute ici les autres librairies que tu utilises dans ton code
|
||||||
Reference in New Issue
Block a user