From af68c39ed00af14fa4690a356537ed8c5f20148e Mon Sep 17 00:00:00 2001 From: kelle Date: Wed, 8 Jul 2026 13:38:18 +0200 Subject: [PATCH] Initial commit: FastAPI Hello-World app for hello-test --- .gitea/workflows/deploy.yaml | 20 ++++++++++++++++++++ .gitignore | 3 +++ Dockerfile | 11 +++++++++++ docker-compose.yml | 13 +++++++++++++ main.py | 8 ++++++++ 5 files changed, 55 insertions(+) create mode 100644 .gitea/workflows/deploy.yaml create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 main.py diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml new file mode 100644 index 0000000..6ac30db --- /dev/null +++ b/.gitea/workflows/deploy.yaml @@ -0,0 +1,20 @@ +name: Deploy App +on: + push: + branches: + - main +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v4 + - name: Deploy to Server + run: | + APP_DIR="/opt/aicds/apps/${GITHUB_REPOSITORY#*/}" + mkdir -p $APP_DIR + cp -a . $APP_DIR/ + cd $APP_DIR + docker compose down || true + docker compose up -d --build + docker image prune -f diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ad86729 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.claude/ +__pycache__/ +*.pyc diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6e8663c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM python:3.11-slim + +WORKDIR /app + +RUN pip install --no-cache-dir fastapi uvicorn[standard] + +COPY main.py . + +EXPOSE 8000 + +CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..002482d --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,13 @@ +services: + app: + build: . + networks: + - agent-net + labels: + - "traefik.enable=true" + - "traefik.http.routers.hellotest.rule=Host(`hello-test.aicds.ch`)" + - "traefik.http.routers.hellotest.entrypoints=websecure" + - "traefik.http.routers.hellotest.tls.certresolver=myresolver" +networks: + agent-net: + external: true diff --git a/main.py b/main.py new file mode 100644 index 0000000..210982a --- /dev/null +++ b/main.py @@ -0,0 +1,8 @@ +from fastapi import FastAPI + +app = FastAPI() + + +@app.get("/") +def read_root(): + return {"message": "Hello from AICDS!"}