update image to 1.1
This commit is contained in:
13
Dockerfile
Normal file
13
Dockerfile
Normal 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"]
|
||||||
27
app/main.py
Normal file
27
app/main.py
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
import os, signal
|
||||||
|
from fastapi import FastAPI
|
||||||
|
|
||||||
|
app = FastAPI()
|
||||||
|
_healthy = True
|
||||||
|
|
||||||
|
@app.get("/")
|
||||||
|
def root ():
|
||||||
|
return {"poruka": "Hello iz mog Docker containera v2!"}
|
||||||
|
|
||||||
|
@app.get("/info")
|
||||||
|
def info():
|
||||||
|
return {
|
||||||
|
"python": platform.python_version(),
|
||||||
|
"verzija": "2.0"
|
||||||
|
}
|
||||||
|
|
||||||
|
@app.get("/health")
|
||||||
|
def health():
|
||||||
|
return {"status": "ok"}
|
||||||
|
|
||||||
|
@app.post("/break")
|
||||||
|
def break_health():
|
||||||
|
"""Simulira pad servisa za testiranje liveness probe-a"""
|
||||||
|
global _healthy
|
||||||
|
_healthy = False
|
||||||
|
return {"message": "Servis je sada nezdrav — ocekuj restart"}
|
||||||
1
manifesti
Submodule
1
manifesti
Submodule
Submodule manifesti added at 2d93d7175f
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