init: FastAPI priprema-za-kolokvij + k8s manifesti (monorepo)
This commit is contained in:
6
.dockerignore
Normal file
6
.dockerignore
Normal file
@@ -0,0 +1,6 @@
|
||||
__pycache__/
|
||||
*.pyc
|
||||
.env
|
||||
.git/
|
||||
*.md
|
||||
k8s/
|
||||
12
Dockerfile
Normal file
12
Dockerfile
Normal file
@@ -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"]
|
||||
11
app/app.py
Normal file
11
app/app.py
Normal file
@@ -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"}
|
||||
0
k8s/deployment.yaml
Normal file
0
k8s/deployment.yaml
Normal file
18
k8s/ingress.yaml
Normal file
18
k8s/ingress.yaml
Normal file
@@ -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!)
|
||||
0
k8s/service.yaml
Normal file
0
k8s/service.yaml
Normal file
2
requirements.txt
Normal file
2
requirements.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
fastapi==0.111.0
|
||||
uvicorn[standard]==0.29.0
|
||||
Reference in New Issue
Block a user