FROM python:3.9 # 1. Install dependencies: curl and zstd (required for Ollama) RUN apt-get update && apt-get install -y curl zstd # 2. Install sshx (Direct install) RUN curl -sSf https://sshx.io/get | sh # 3. Install Ollama RUN curl -fsSL https://ollama.com/install.sh | sh WORKDIR /app COPY . . RUN pip install --no-cache-dir -r requirements.txt # 4. Start everything # Ollama runs in background (&) # sshx runs in background (&) and prints the link to logs # Web app (uvicorn) stays in foreground to keep the Space alive CMD ollama serve & (sleep 5 && sshx) & uvicorn app:app --host 0.0.0.0 --port 7860