alesamodio commited on
Commit
91e3cb8
·
1 Parent(s): 966c26c

first push

Browse files
Files changed (4) hide show
  1. Dockerfile +6 -0
  2. app.py +17 -0
  3. requirements.txt +2 -0
  4. runtime.txt +1 -0
Dockerfile ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ FROM python:3.10
2
+ WORKDIR /app
3
+ COPY requirements.txt .
4
+ RUN pip install -r requirements.txt
5
+ COPY app.py .
6
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
app.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastapi import FastAPI
2
+ import datetime, os
3
+
4
+ app = FastAPI()
5
+
6
+ @app.get("/")
7
+ def home():
8
+ return {"status": "running", "message": "trigger space is alive"}
9
+
10
+ @app.get("/run")
11
+ def run_task():
12
+ """Simple test endpoint that creates a text file in /tmp."""
13
+ filename = "/tmp/test.txt"
14
+ with open(filename, "a") as f:
15
+ f.write(f"Triggered at {datetime.datetime.utcnow().isoformat()}\n")
16
+ print(f"✅ File created at {filename}")
17
+ return {"status": "ok", "message": "test.txt created"}
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ fastapi
2
+ uvicorn
runtime.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ python-3.10