commit 553330cdcba34233c323f1b9d0809ad1c4aaec66 Author: Mihael Janjic Date: Thu Jun 25 11:47:28 2026 +0200 first commit diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..dd3b7cc --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +__pycache__/ +*.pyc +.env +.git/ +*.md +k8s/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..89d5511 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +# OVAJ FAJL PIŠEŠ TI — vidi zadatak za zahtjeve +FROM python:3.12-slim + +WORKDIR /app + +COPY requirements.txt . +RUN pop install --no-cache-dir -rrequirements.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/main.py b/app/main.py new file mode 100644 index 0000000..287121b --- /dev/null +++ b/app/main.py @@ -0,0 +1,14 @@ +import os +from fastapi import FastAPI + +app = FastAPI() + +AUTOR = os.getenv("AUTOR", "nepoznat") + +@app.get("/") +def root(): + return {"message": "Ispitni rok 1", "autor": AUTOR} + +@app.get("/health") +def health(): + return {"status": "ok"} diff --git a/k8s/deployment.yaml b/k8s/deployment.yaml new file mode 100644 index 0000000..9f56dba --- /dev/null +++ b/k8s/deployment.yaml @@ -0,0 +1,21 @@ +# OVAJ FAJL PIŠEŠ TI — vidi specifikaciju u zadatku +apiVersion: apps/v1 +kind: Deployment +metadata: + name: ispit-app + namespace: ispit1-mihaeljanjic +spec: + replicas: 2 + selector: + matchLabels: + app: ispit-app + template: + metadata: + labels: + app: ispit-app + spec: + containers: + - name: ispit-app + image: git.fpmoz.sum.ba/mihaeljanjic/ispit-app:1.0 + ports: + - containerPort: 8000 \ No newline at end of file diff --git a/k8s/ingress.yaml b/k8s/ingress.yaml new file mode 100644 index 0000000..0aab7fd --- /dev/null +++ b/k8s/ingress.yaml @@ -0,0 +1,19 @@ +# OVAJ FAJL PIŠEŠ TI — vidi specifikaciju u zadatku +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: ispit-ingress + namespace: ispit1-mihaeljanjic +spec: + ingressClassName: traefic + rules: + - host: mihaeljanjic.argocd.fpmoz.sum.ba + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: ispit-svc + port: + number: 80 \ No newline at end of file diff --git a/k8s/service.yaml b/k8s/service.yaml new file mode 100644 index 0000000..7005795 --- /dev/null +++ b/k8s/service.yaml @@ -0,0 +1,14 @@ +# OVAJ FAJL PIŠEŠ TI — vidi specifikaciju u zadatku +apiVersion: v1 +kind: Service +metadata: + name: ispit-service + namespace: ispit1-mihaeljanjic +spec: + selector: + app: ispit-app + ports: + - port: 80 + targetPort: 8000 + protocol: TCP + type: ClusterIP \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..c83aa69 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +fastapi==0.111.0 +uvicorn[standard]==0.29.0