diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f1dc70a --- /dev/null +++ b/Dockerfile @@ -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"] diff --git a/app/main.py b/app/main.py new file mode 100644 index 0000000..0640519 --- /dev/null +++ b/app/main.py @@ -0,0 +1,21 @@ +from fastapi import FastAPI + +APP_NAME = "Python FastAPI Template" +APP_VERSION = "1.0.0" + +app = FastAPI( + title=APP_NAME, + version=APP_VERSION +) + +@app.get("/health") +def health(): + return {"status": "ok"} + +@app.get("/version") +def version(): + return { + "app": APP_NAME, + "version": APP_VERSION, + "language": "python" + } diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..364e2ee --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +fastapi +uvicorn[standard]