From 8a54e75d4ebbdf7a70a7b710f959b2d7a92b09a1 Mon Sep 17 00:00:00 2001 From: inference-bot Date: Wed, 9 Sep 2026 13:23:53 -0600 Subject: [PATCH] Download tinfoil-proxy at runtime (build sandbox has no GitHub access) --- Dockerfile | 11 +---------- start.sh | 14 +++++++++++++- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index b33f509..fa9be54 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,16 +6,7 @@ FROM ghcr.io/berriai/litellm:main-v1.74.0-stable # volume-ownership issues. # Create the data directory (Cloudron mounts the localstorage volume here) -RUN mkdir -p /app/data - -# Tinfoil proxy — a verified local proxy that encrypts request/response bodies -# with EHBP (HPKE) before forwarding to the Tinfoil enclave. LiteLLM's openai/ -# provider sends plaintext, which Tinfoil rejects (426 EHBP_REQUIRED), so the -# proxy sits between LiteLLM and the enclave. Statically-linked Go binary, -# pinned to a specific release for reproducible builds. Downloaded with Python -# (guaranteed present in the Python base image) rather than curl/wget. -RUN python3 -c "import urllib.request; urllib.request.urlretrieve('https://github.com/tinfoilsh/tinfoil-proxy/releases/download/v0.2.3/tinfoil-proxy-linux-amd64', '/app/code/tinfoil-proxy')" \ - && chmod +x /app/code/tinfoil-proxy +RUN mkdir -p /app/data /app/code # Create a startup script that configures LiteLLM with Cloudron addons COPY start.sh /app/code/start.sh diff --git a/start.sh b/start.sh index 11c7796..b3e826c 100644 --- a/start.sh +++ b/start.sh @@ -131,8 +131,20 @@ echo "Starting LiteLLM on port 4000..." # attestation and encrypts request/response bodies with EHBP (HPKE), so # LiteLLM can talk plaintext OpenAI to it while the proxy handles the # end-to-end encryption to the Tinfoil enclave. +# +# The proxy binary is downloaded at runtime into /app/data (persistent, +# writable) because Cloudron's build sandbox has no outbound network access to +# GitHub. The running container does, so we fetch it here on first start. +TINFOIL_PROXY_BIN="/app/data/tinfoil-proxy" +TINFOIL_PROXY_VERSION="v0.2.3" +if [ ! -f "$TINFOIL_PROXY_BIN" ]; then + echo "Downloading Tinfoil proxy ${TINFOIL_PROXY_VERSION}..." + python3 -c "import urllib.request; urllib.request.urlretrieve('https://github.com/tinfoilsh/tinfoil-proxy/releases/download/${TINFOIL_PROXY_VERSION}/tinfoil-proxy-linux-amd64', '${TINFOIL_PROXY_BIN}')" + chmod +x "$TINFOIL_PROXY_BIN" +fi + echo "Starting Tinfoil proxy on 127.0.0.1:3301..." -/app/code/tinfoil-proxy -b 127.0.0.1 -p 3301 & +"$TINFOIL_PROXY_BIN" -b 127.0.0.1 -p 3301 & TINFOIL_PROXY_PID=$! echo "Tinfoil proxy PID: $TINFOIL_PROXY_PID"