repo setup
This commit is contained in:
18
packages/backend/Dockerfile
Normal file
18
packages/backend/Dockerfile
Normal file
@@ -0,0 +1,18 @@
|
||||
# Usa un'immagine Python ufficiale
|
||||
FROM python:3.11-slim
|
||||
|
||||
# Imposta la directory di lavoro
|
||||
WORKDIR /app
|
||||
|
||||
# Copia il file delle dipendenze
|
||||
# Questo step viene messo in cache da Docker se il file non cambia
|
||||
COPY requirements.txt .
|
||||
|
||||
# Installa le dipendenze usando pip
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Copia il resto del codice sorgente
|
||||
COPY . .
|
||||
|
||||
# Comando per avviare il server Uvicorn in modalità sviluppo (con hot-reload)
|
||||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
|
||||
10
packages/backend/alembic.ini
Normal file
10
packages/backend/alembic.ini
Normal file
@@ -0,0 +1,10 @@
|
||||
# ... altre configurazioni ...
|
||||
[alembic]
|
||||
# ...
|
||||
script_location = alembic
|
||||
# ...
|
||||
|
||||
# Aggiungi questa riga per leggere l'URL dal file .env
|
||||
sqlalchemy.url = ${DATABASE_URL}
|
||||
|
||||
# ... altre configurazioni ...
|
||||
BIN
packages/backend/app/__pycache__/main.cpython-311.pyc
Normal file
BIN
packages/backend/app/__pycache__/main.cpython-311.pyc
Normal file
Binary file not shown.
11
packages/backend/app/main.py
Normal file
11
packages/backend/app/main.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from fastapi import FastAPI
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
@app.get("/api")
|
||||
def read_root():
|
||||
return {"message": "Ciao dal backend FastAPI!"}
|
||||
|
||||
@app.get("/api/health")
|
||||
def health_check():
|
||||
return {"status": "ok"}
|
||||
8
packages/backend/requirements.txt
Normal file
8
packages/backend/requirements.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
# FastAPI e server
|
||||
fastapi
|
||||
uvicorn[standard]
|
||||
|
||||
# Database
|
||||
sqlalchemy
|
||||
psycopg2-binary
|
||||
alembic
|
||||
Reference in New Issue
Block a user