commit 502e190aba7350bf5a25283fd289f1e631058261 Author: GalicIvan Date: Thu Jun 25 00:10:26 2026 +0200 init: FastAPI priprema-za-kolokvij + k8s manifesti (monorepo) diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..1e74d02 Binary files /dev/null and b/.DS_Store differ diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..7079a7b --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +__pycache__/ +*.pyc +.env +.git/ +*.md +k8s/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..21e7cd9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM python:3.12-slim + +WORKDIR /app + +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt + +COPY app/ ./app/ + +EXPOSE 8000 + +CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"] \ No newline at end of file diff --git a/app/app.py b/app/app.py new file mode 100644 index 0000000..89fd921 --- /dev/null +++ b/app/app.py @@ -0,0 +1,11 @@ +from fastapi import FastAPI + +app = FastAPI() + +@app.get("/") +def root(): + return {"message": "Pozdrav svijete!", "autor": "GalicIvan"} + +@app.get("/health") +def health(): + return {"status": "ok"} \ No newline at end of file diff --git a/k8s/deployment.yaml b/k8s/deployment.yaml new file mode 100644 index 0000000..e69de29 diff --git a/k8s/ingress.yaml b/k8s/ingress.yaml new file mode 100644 index 0000000..c3e8420 --- /dev/null +++ b/k8s/ingress.yaml @@ -0,0 +1,18 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: priprema-ingress + namespace: student-GalicIvan +spec: + ingressClassName: traefik + rules: + - host: GalicIvan.argocd.fpmoz.sum.ba + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: priprema-svc # mora odgovarati service.yaml + port: + number: 80 # port Servicea (ne containera!) \ No newline at end of file diff --git a/k8s/service.yaml b/k8s/service.yaml new file mode 100644 index 0000000..e69de29 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..d50dc68 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +fastapi==0.111.0 +uvicorn[standard]==0.29.0 \ No newline at end of file