agregando fastapi

This commit is contained in:
danielcruzmx
2026-03-11 18:18:42 -06:00
parent 1a2f9d6431
commit 9b1869ac14
6 changed files with 56 additions and 3 deletions

5
apps/api/Containerfile Normal file
View File

@@ -0,0 +1,5 @@
FROM python:3.11-slim
COPY . /home
WORKDIR /home
RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt

Binary file not shown.

7
apps/api/code/main.py Normal file
View File

@@ -0,0 +1,7 @@
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
async def root():
return("Hola Mundo")

View File

@@ -0,0 +1,8 @@
fastapi
redis
gunicorn
postgres
uvicorn
SQLAlchemy
pydantic
databases

33
infra/api_pod.yaml Normal file
View File

@@ -0,0 +1,33 @@
---
apiVersion: v1
kind: Pod
metadata:
name: api_stack_pod
labels:
app: ciec_stack
spec:
containers:
- name: fastapi-app
image: localhost/fastapi
command: ["uvicorn","main:app","--host=0.0.0.0","--port=8000","--reload"]
ports:
- containerPort: 8000
hostPort: 8082
envFrom:
- configMapRef:
name: ciec-config
volumeMounts:
- name: apps-storage
mountPath: /home
- name: redis-cache
image: docker.io/library/redis:latest
ports:
- containerPort: 6379
volumes:
- name: apps-storage
hostPath:
path: /home/danielcruzmx/projecto_ciec_v6/apps/api/code
type: DirectoryOrCreate

View File

@@ -6,7 +6,7 @@ kind: Pod
metadata: metadata:
name: db_stack_pod name: db_stack_pod
labels: labels:
app: db_stack app: ciec_stack
spec: spec:
containers: containers:
@@ -16,7 +16,7 @@ spec:
- containerPort: 5432 - containerPort: 5432
envFrom: envFrom:
- configMapRef: - configMapRef:
name: postgres-config name: ciec-config
volumeMounts: volumeMounts:
- name: postgres-storage - name: postgres-storage
mountPath: /var/lib/postgresql mountPath: /var/lib/postgresql
@@ -27,7 +27,7 @@ spec:
hostPort: 8081 hostPort: 8081
envFrom: envFrom:
- configMapRef: - configMapRef:
name: postgres-config name: ciec-config
volumeMounts: volumeMounts:
- name: pgadmin-data - name: pgadmin-data
mountPath: /var/lib/pgadmin mountPath: /var/lib/pgadmin