agregando fastapi
This commit is contained in:
5
apps/api/Containerfile
Normal file
5
apps/api/Containerfile
Normal 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
|
||||||
BIN
apps/api/code/__pycache__/main.cpython-311.pyc
Normal file
BIN
apps/api/code/__pycache__/main.cpython-311.pyc
Normal file
Binary file not shown.
7
apps/api/code/main.py
Normal file
7
apps/api/code/main.py
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
from fastapi import FastAPI
|
||||||
|
|
||||||
|
app = FastAPI()
|
||||||
|
|
||||||
|
@app.get("/")
|
||||||
|
async def root():
|
||||||
|
return("Hola Mundo")
|
||||||
8
apps/api/requirements.txt
Normal file
8
apps/api/requirements.txt
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
fastapi
|
||||||
|
redis
|
||||||
|
gunicorn
|
||||||
|
postgres
|
||||||
|
uvicorn
|
||||||
|
SQLAlchemy
|
||||||
|
pydantic
|
||||||
|
databases
|
||||||
33
infra/api_pod.yaml
Normal file
33
infra/api_pod.yaml
Normal 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
|
||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user