main.py
from fastapi import FastAPI
import uvicorn
app=FastAPI()
@app.get('/')
def index():
return 'Hello FastAPI'
if __name__ == "__main__":
uvicorn.run(app,host="0.0.0.0")
Dockerfile
FROM docker.1ms.run/python:3.12-slim
RUN pip install uv -i https://pypi.tuna.tsinghua.edu.cn/simple
COPY unisee /app/unisee
WORKDIR /app/unisee
RUN uv sync
EXPOSE 8000
ENTRYPOINT ["uv","run","main.py"]
podman build -t test:1.0 .
podman run --rm --name test p 8001:8000 test:1.0
curl http://127.0.0.1:8001/
>>>'Hello FastAPI'
679

被折叠的 条评论
为什么被折叠?



