Untitled
unknown
plain_text
8 months ago
516 B
12
Indexable
main.py
-----------
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
def read_root():
return {"message": "Hello, Docker!"}
-----------
-----------
-----------
-----------
Dockerfile
-----------
# Usa Python 3.9
FROM python:3.9
# Imposta la directory di lavoro
WORKDIR /app
# Copia i file
COPY . /app
# Installa FastAPI e Uvicorn
RUN pip install fastapi uvicorn
# Comando per avviare il server
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8123"]
Editor is loading...
Leave a Comment