Untitled

Anonymous
Plain Text
02/24/2025 10:20 PM
516 B
21
Indexable
Never
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