diff --git a/apps/api/Containerfile b/apps/api/Containerfile new file mode 100644 index 0000000..752fa42 --- /dev/null +++ b/apps/api/Containerfile @@ -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 diff --git a/apps/api/code/__pycache__/main.cpython-311.pyc b/apps/api/code/__pycache__/main.cpython-311.pyc new file mode 100644 index 0000000..9e5879c Binary files /dev/null and b/apps/api/code/__pycache__/main.cpython-311.pyc differ diff --git a/apps/api/code/main.py b/apps/api/code/main.py new file mode 100644 index 0000000..ddc240c --- /dev/null +++ b/apps/api/code/main.py @@ -0,0 +1,7 @@ +from fastapi import FastAPI + +app = FastAPI() + +@app.get("/") +async def root(): + return("Hola Mundo") diff --git a/apps/api/requirements.txt b/apps/api/requirements.txt new file mode 100644 index 0000000..e2de34a --- /dev/null +++ b/apps/api/requirements.txt @@ -0,0 +1,8 @@ +fastapi +redis +gunicorn +postgres +uvicorn +SQLAlchemy +pydantic +databases diff --git a/infra/api_pod.yaml b/infra/api_pod.yaml new file mode 100644 index 0000000..dc0e42c --- /dev/null +++ b/infra/api_pod.yaml @@ -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 diff --git a/infra/db_pod.yaml b/infra/db_pod.yaml index 43b3c81..120d6d9 100644 --- a/infra/db_pod.yaml +++ b/infra/db_pod.yaml @@ -6,7 +6,7 @@ kind: Pod metadata: name: db_stack_pod labels: - app: db_stack + app: ciec_stack spec: containers: @@ -16,7 +16,7 @@ spec: - containerPort: 5432 envFrom: - configMapRef: - name: postgres-config + name: ciec-config volumeMounts: - name: postgres-storage mountPath: /var/lib/postgresql @@ -27,7 +27,7 @@ spec: hostPort: 8081 envFrom: - configMapRef: - name: postgres-config + name: ciec-config volumeMounts: - name: pgadmin-data mountPath: /var/lib/pgadmin