This commit is contained in:
ITO Mac
2026-05-26 10:23:44 +02:00
parent e989617b6d
commit c8cd541348
7 changed files with 92 additions and 0 deletions

6
app/.dockerignore Normal file
View File

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

15
app/Dockerfile Normal file
View File

@@ -0,0 +1,15 @@
FROM python:3.12-slim
WORKDIR /app
# Kopiraj ovisnosti PRVO — ako se ne mijenjaju, pip install se preskace (cache hit)
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Kopiraj kod NAKON instalacije
COPY app/ ./app/
EXPOSE 8000
# OBAVEZNO: --host 0.0.0.0 da Ingress moze pristupiti containeru
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]

11
app/main.py Normal file
View File

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

2
app/requirements.txt Normal file
View File

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