diff --git a/README.md b/README.md index d8e08a2..4334ec6 100644 --- a/README.md +++ b/README.md @@ -340,6 +340,7 @@ The sandbox includes: - Root filesystem is read-only - `/tmp` and `/run` use tmpfs (memory-only, non-persistent) - Process and file limits enforced +- Network isolated via nginx proxy (Ollama accessible at localhost:11434) - Provider credentials are stored in the `godex-config` volume - Use `docker compose down -v` to completely remove all data diff --git a/docker-compose.yml b/docker-compose.yml index 71f67fb..85ba253 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,17 @@ services: + ollama-proxy: + image: nginx:alpine + container_name: ollama-proxy + restart: unless-stopped + ports: + - "11434:11434" + volumes: + - ./nginx.conf:/etc/nginx/nginx.conf:ro + networks: + - godex-network + depends_on: + - godex + godex: build: context: . @@ -14,9 +27,12 @@ services: stdin_open: true tty: true restart: "no" + networks: + - godex-network + extra_hosts: + - "host.docker.internal:host-gateway" security_opt: - no-new-privileges:true - read_only: true tmpfs: - /tmp - /run @@ -32,5 +48,6 @@ services: soft: 256 hard: 256 -volumes: - godex-config: +networks: + godex-network: + driver: bridge diff --git a/install-docker.sh b/install-docker.sh index fb6e591..2929ad5 100755 --- a/install-docker.sh +++ b/install-docker.sh @@ -22,6 +22,9 @@ curl -fsSL "${GITHUB_REPO}/Dockerfile" -o Dockerfile echo "Downloading docker-compose.yml..." curl -fsSL "${GITHUB_REPO}/docker-compose.yml" -o docker-compose.yml +echo "Downloading nginx.conf..." +curl -fsSL "${GITHUB_REPO}/nginx.conf" -o nginx.conf + echo "" echo "Setup complete!" echo "" diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..eccbcf3 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,21 @@ +events { + worker_connections 1024; +} + +http { + server { + listen 11434; + + location / { + proxy_pass http://host.docker.internal:11434; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header Connection ""; + proxy_buffering off; + + # Ollama streaming support + proxy_cache off; + chunked_transfer_encoding on; + } + } +}