2025-12-15 12:52:31 +01:00
2025-12-15 12:52:31 +01:00
2025-12-15 12:51:48 +01:00
2025-12-15 11:42:17 +01:00
2025-12-15 11:42:17 +01:00

Taller CI/CD con Jenkins - Proyecto base

  • backend/: API con FastAPI.
  • frontend/: interfaz en Svelte (Vite).

Requisitos locales

  • Python 3.11+ y pip
  • Node 18+ y npm

Backend (FastAPI)

cd backend
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
uvicorn app.main:app --reload --port 8000

Endpoints:

  • GET /health estado.
  • GET /menu devuelve el menú del día.
  • GET /prices lista de precios aleatorios.
  • GET /prices/{item} precio aleatorio para un item concreto.

Tests y lint:

cd backend
pip install -r requirements-dev.txt
pytest
ruff check app tests

Docker:

cd backend
docker build -t cafeteria-backend .
docker run -p 8000:8000 cafeteria-backend

Frontend (Svelte)

cd frontend
npm install
npm run dev -- --host --port 5173

Tests, lint/check:

cd frontend
npm test # no, no voy a hacer tests de frontend
npm run check

Docker (sirve con nginx):

cd frontend
docker build -t cafeteria-frontend .
docker run -p 8080:80 cafeteria-frontend

Jenkinsfile (pipeline)

Incluido Jenkinsfile declarativo para ejecutar en un agente cualquiera con Python 3.11+, Node 18+ y Docker:

  • Backend: crea entorno virtual, instala requirements-dev, pasa ruff y pytest.
  • Frontend: npm install, npm run check y npm test, luego npm run build.
  • Docker: construye imágenes cafeteria-backend y cafeteria-frontend si existen los Dockerfile.
  • Se despliegan las imágenes.
  • En la aplicación se recupera el último commit y el autor.
Description
No description provided
Readme 252 KiB
Languages
Svelte 36.2%
CSS 27.4%
Python 26%
JavaScript 7.3%
Dockerfile 2.4%
Other 0.7%