Spaces:
Paused
Paused
Upload 3 files
Browse files- Dockerfile.txt +20 -0
- app.py +9 -0
- requirements.txt +3 -0
Dockerfile.txt
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.9
|
| 2 |
+
|
| 3 |
+
# 1. Install dependencies: curl and zstd (required for Ollama)
|
| 4 |
+
RUN apt-get update && apt-get install -y curl zstd
|
| 5 |
+
|
| 6 |
+
# 2. Install sshx (Direct install)
|
| 7 |
+
RUN curl -sSf https://sshx.io/get | sh
|
| 8 |
+
|
| 9 |
+
# 3. Install Ollama
|
| 10 |
+
RUN curl -fsSL https://ollama.com/install.sh | sh
|
| 11 |
+
|
| 12 |
+
WORKDIR /app
|
| 13 |
+
COPY . .
|
| 14 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 15 |
+
|
| 16 |
+
# 4. Start everything
|
| 17 |
+
# Ollama runs in background (&)
|
| 18 |
+
# sshx runs in background (&) and prints the link to logs
|
| 19 |
+
# Web app (uvicorn) stays in foreground to keep the Space alive
|
| 20 |
+
CMD ollama serve & (sleep 5 && sshx) & uvicorn app:app --host 0.0.0.0 --port 7860
|
app.py
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi import FastAPI
|
| 2 |
+
from fastapi import Request
|
| 3 |
+
|
| 4 |
+
app = FastAPI()
|
| 5 |
+
|
| 6 |
+
# This handles GET, HEAD, and everything else
|
| 7 |
+
@app.api_route("/", methods=["GET", "HEAD"])
|
| 8 |
+
def root(request: Request):
|
| 9 |
+
return {"message": "VPS is active", "method": request.method}
|
requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fastapi
|
| 2 |
+
uvicorn
|
| 3 |
+
requests
|