From 4c3cb9315a1dd775ca3cf04a638524ace6a9b2eb Mon Sep 17 00:00:00 2001 From: agatha Date: Fri, 12 Apr 2024 17:12:37 -0400 Subject: [PATCH] add fastapi --- backend/Dockerfile | 10 ++++++++++ backend/README.md | 7 +++++++ backend/requirements.txt | 4 ++++ backend/src/main.py | 9 +++++++++ 4 files changed, 30 insertions(+) create mode 100644 backend/Dockerfile create mode 100644 backend/README.md create mode 100644 backend/requirements.txt create mode 100644 backend/src/main.py diff --git a/backend/Dockerfile b/backend/Dockerfile new file mode 100644 index 0000000..414213b --- /dev/null +++ b/backend/Dockerfile @@ -0,0 +1,10 @@ +FROM python:alpine +WORKDIR /app/backend + +COPY ./requirements.txt /app +RUN pip install --no-cache-dir -r /app/requirements.txt + +COPY ./src /app/backend + +EXPOSE 8000 +CMD ["uvicorn", "main:app", "--host", "0.0.0.0"] diff --git a/backend/README.md b/backend/README.md new file mode 100644 index 0000000..f4e3dfc --- /dev/null +++ b/backend/README.md @@ -0,0 +1,7 @@ +# Daily Agenda App Backend +Written in FastAPI. + +```shell +docker build -t agenda-backend . +docker run --rm agenda-backend +``` diff --git a/backend/requirements.txt b/backend/requirements.txt new file mode 100644 index 0000000..be6eebf --- /dev/null +++ b/backend/requirements.txt @@ -0,0 +1,4 @@ +fastapi +uvicorn[standard] +sqlalchemy +pydantic diff --git a/backend/src/main.py b/backend/src/main.py new file mode 100644 index 0000000..50a628f --- /dev/null +++ b/backend/src/main.py @@ -0,0 +1,9 @@ +from fastapi import FastAPI + +app = FastAPI() + + +@app.get('/') +async def home(): + return 'homepage' +