From e02a6c46fa9830fb003b0ca845ef601fd4ca3323 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E9=91=AB?= Date: Thu, 30 Oct 2025 15:11:34 +0800 Subject: [PATCH] init --- Dockerfile | 12 ++++++++++++ main.py | 11 +++++++++++ requirements.txt | 2 ++ 3 files changed, 25 insertions(+) create mode 100644 Dockerfile create mode 100644 main.py create mode 100644 requirements.txt diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..cc1deb7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM python:3.9-slim + +WORKDIR /app + +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt + +COPY . . + +EXPOSE 3000 + +CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "3000"] \ No newline at end of file diff --git a/main.py b/main.py new file mode 100644 index 0000000..fa40845 --- /dev/null +++ b/main.py @@ -0,0 +1,11 @@ +from fastapi import FastAPI + +app = FastAPI() + +@app.get("/") +def read_root(): + return {"message": "Hello World"} + +if __name__ == "__main__": + import uvicorn + uvicorn.run(app, host="0.0.0.0", port=3000) \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..3ad1474 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +fastapi==0.120.2 +uvicorn==0.29.0 \ No newline at end of file