initial commit

This commit is contained in:
Ludwig Lehnert 2025-02-14 20:54:05 +01:00
commit 07026dfc37
4 changed files with 41 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
venv/

18
Dockerfile Normal file
View File

@ -0,0 +1,18 @@
# Use an official Python image as the base
FROM python:3.10
# Set the working directory
WORKDIR /app
# Copy the application files
COPY server.py /app/
COPY requirements.txt /app/
# Install dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Expose the application port
EXPOSE 8000
# Run the FastAPI application using Uvicorn
CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "8000"]

2
requirements.txt Normal file
View File

@ -0,0 +1,2 @@
fastapi
uvicorn

19
server.py Normal file
View File

@ -0,0 +1,19 @@
from fastapi import FastAPI, Request
import uvicorn
app = FastAPI()
@app.get("/")
def read_root():
return {"message": "Server is running!"}
@app.post("/")
async def receive_data(request: Request):
data = await request.json()
print(data)
return {"received_data": data}
if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=8000)