prvi commit

This commit is contained in:
2026-05-26 10:24:17 +02:00
commit 5a29838538
7 changed files with 105 additions and 0 deletions

6
.dockerignore Normal file
View File

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

13
Dockerfile Normal file
View File

@@ -0,0 +1,13 @@
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"]

16
app/main.py Normal file
View File

@@ -0,0 +1,16 @@
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
def root():
return {
"message": "Pozdrav svijete!",
"autor": "iva"
}
@app.get("/health")
def health():
return {
"status": "ok"
}

27
k8s/deployment.yaml Normal file
View File

@@ -0,0 +1,27 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: priprema-za-kolokvij
namespace: student-iva
spec:
replicas: 1
selector:
matchLabels:
app: priprema-za-kolokvij
template:
metadata:
labels:
app: priprema-za-kolokvij
spec:
containers:
- name: priprema-za-kolokvij
image: git.fpmoz.sum.ba/iva/priprema-za-kolokvij:1.0
ports:
- containerPort: 8000

25
k8s/ingress.yaml Normal file
View File

@@ -0,0 +1,25 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: priprema-ingress
namespace: student-iva
spec:
ingressClassName: traefik
rules:
- host: iva.argocd.fpmoz.sum.ba
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: priprema-svc
port:
number: 80

16
k8s/service.yaml Normal file
View File

@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: priprema-svc
namespace: student-iva
spec:
selector:
app: priprema-za-kolokvij
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