From ce73a77783b54b52cca12e2b6370d0b43dcb285b Mon Sep 17 00:00:00 2001 From: Luke Calladine Date: Mon, 12 Jan 2026 16:29:06 +0000 Subject: [PATCH] Add simple FastAPI backend --- backend/docker/Dockerfile | 12 ++++++++++++ backend/requirements.txt | 2 ++ backend/src/main.py | 11 +++++++++++ docker-compose.yml | 8 ++++++++ 4 files changed, 33 insertions(+) create mode 100644 backend/docker/Dockerfile create mode 100644 backend/requirements.txt create mode 100644 backend/src/main.py create mode 100644 docker-compose.yml diff --git a/backend/docker/Dockerfile b/backend/docker/Dockerfile new file mode 100644 index 0000000..d3e9d77 --- /dev/null +++ b/backend/docker/Dockerfile @@ -0,0 +1,12 @@ +FROM python:3.13.7-slim-bookworm + +WORKDIR /app + +# Copy requirements and install Python dependencies +COPY ./requirements.txt ./ +RUN pip install --no-cache-dir -r requirements.txt + +# Copy the app code and tests +COPY ../src ./src + +CMD ["python", "src/main.py"] diff --git a/backend/requirements.txt b/backend/requirements.txt new file mode 100644 index 0000000..8e0578a --- /dev/null +++ b/backend/requirements.txt @@ -0,0 +1,2 @@ +fastapi +uvicorn[standard] \ No newline at end of file diff --git a/backend/src/main.py b/backend/src/main.py new file mode 100644 index 0000000..66cc0bc --- /dev/null +++ b/backend/src/main.py @@ -0,0 +1,11 @@ +from fastapi import FastAPI + +app = FastAPI(title="HanchuESS Solar Backend API") + +@app.get("/", tags=["Root"]) +def root(): + return {"message": "Welcome to the HanchuESS Solar Backend API!"} + +if __name__ == "__main__": + import uvicorn + uvicorn.run(app, host="0.0.0.0", port=8050) \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..c74fef8 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,8 @@ +services: + hanchuess-solar-backend: + build: + context: backend + dockerfile: docker/Dockerfile + container_name: hanchuess-solar-backend + ports: + - "8050:8050" \ No newline at end of file