Add simple FastAPI backend #2

Merged
preteck merged 1 commits from create-backend into main 2026-01-12 11:35:48 -05:00
4 changed files with 33 additions and 0 deletions
Showing only changes of commit ce73a77783 - Show all commits

12
backend/docker/Dockerfile Normal file
View File

@@ -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"]

2
backend/requirements.txt Normal file
View File

@@ -0,0 +1,2 @@
fastapi
uvicorn[standard]

11
backend/src/main.py Normal file
View File

@@ -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)

8
docker-compose.yml Normal file
View File

@@ -0,0 +1,8 @@
services:
hanchuess-solar-backend:
build:
context: backend
dockerfile: docker/Dockerfile
container_name: hanchuess-solar-backend
ports:
- "8050:8050"