This commit is contained in:
2026-06-25 11:53:12 +02:00
commit 800c9ec9f2
7 changed files with 94 additions and 0 deletions

6
.dockerignore Normal file
View File

@@ -0,0 +1,6 @@
__pycache__/
*.pyc
.env
.git/
*.md
k8s/

15
Dockerfile Normal file
View File

@@ -0,0 +1,15 @@
# OVAJ FAJL PIŠEŠ TI — vidi zadatak za zahtjeve
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"]

14
app/main.py Normal file
View File

@@ -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"}

24
k8s/deployment.yaml Normal file
View File

@@ -0,0 +1,24 @@
# OVAJ FAJL PIŠEŠ TI — vidi specifikaciju u zadatku
apiVersion: apps/v1
kind: Deployment
metadata:
name: ispit-app
namespace: ispit1-petracamber
mspec:
replicas: 2
selector:
matchLabels:
app: ispit-app
template:
metadata:
labels:
app: ispit-app
spec:
containers:
- name: ispit-app
image: git.fpmoz.sum.ba/petracamber/ispit-app:1.0
ports:
- containerPort: 8000
env:
- name: AUTOR-PetraCamber
value: "petracamber"

20
k8s/ingress.yaml Normal file
View File

@@ -0,0 +1,20 @@
# OVAJ FAJL PIŠEŠ TI — vidi specifikaciju u zadatku
apiVersion: networking.k8s.io/v1
kind: ingress
metadata:
name: ispit-ingress
namespace: ispit1-petracamber
spec:
ingressClassName: traefik
rules:
- host: petracamber.argocd.fpmoz.sum.ba
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: ispit-svc
port:
number: 80

13
k8s/service.yaml Normal file
View File

@@ -0,0 +1,13 @@
# OVAJ FAJL PIŠEŠ TI — vidi specifikaciju u zadatku
apiVersion: v1
kind: service
metadata:
name: ispit-svc
namespace: ispit1-petracamber
spec:
selector:
app: ispit-app
ports:
- port: 80
targetPort: 8000
type: ClusterIP

2
requirements.txt Normal file
View File

@@ -0,0 +1,2 @@
fastapi==0.111.0
uvicorn[standard]==0.29.0