-
Notifications
You must be signed in to change notification settings - Fork 9
add computesdk image to hub #178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| ARG SANDBOX_VERSION=latest | ||
| FROM --platform=linux/amd64 ghcr.io/blaxel-ai/sandbox:${SANDBOX_VERSION} AS blaxel | ||
|
|
||
| # Use ComputeSDK self-hosted compute runtime as base (Debian Bookworm) | ||
| FROM --platform=linux/amd64 computesdk/compute:latest | ||
|
|
||
| # Copy Blaxel sandbox API binary (required for all Blaxel sandbox templates) | ||
| COPY --from=blaxel /sandbox-api /usr/local/bin/sandbox-api | ||
|
|
||
| # Switch to root for package installation | ||
| USER root | ||
|
|
||
| # Install netcat for the health-check loop in entrypoint.sh | ||
| RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
| netcat-openbsd \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dockerfile missing explicit
|
||
|
|
||
| # Copy and set up entrypoint | ||
| COPY entrypoint.sh /entrypoint.sh | ||
| RUN chmod +x /entrypoint.sh | ||
|
|
||
| ENTRYPOINT ["/entrypoint.sh"] | ||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,38 @@ | ||||||||||||
| #!/bin/sh | ||||||||||||
|
|
||||||||||||
| # Normalize ComputeSDK credential env vars BEFORE starting any processes. | ||||||||||||
| # The compute binary reads API_KEY / ACCESS_TOKEN directly, but users may | ||||||||||||
| # pass COMPUTESDK_API_KEY / COMPUTESDK_ACCESS_TOKEN instead. | ||||||||||||
| export API_KEY="${API_KEY:-${COMPUTESDK_API_KEY:-}}" | ||||||||||||
| export ACCESS_TOKEN="${ACCESS_TOKEN:-${COMPUTESDK_ACCESS_TOKEN:-}}" | ||||||||||||
|
|
||||||||||||
| # Start the Blaxel sandbox API (required) | ||||||||||||
| # It inherits the exported env vars, so child processes it spawns will too. | ||||||||||||
| /usr/local/bin/sandbox-api & | ||||||||||||
|
|
||||||||||||
| # Wait for sandbox API to be ready | ||||||||||||
| echo "Waiting for sandbox API..." | ||||||||||||
| while ! nc -z 127.0.0.1 8080; do | ||||||||||||
| sleep 0.1 | ||||||||||||
| done | ||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Health-check loop lacks timeout, may hang foreverMedium Severity The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bugbot Autofix determined this is a false positive. The referenced file This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard. |
||||||||||||
|
|
||||||||||||
| echo "Sandbox API ready" | ||||||||||||
|
|
||||||||||||
| # Start the ComputeSDK compute daemon via the sandbox API process manager. | ||||||||||||
| if [ -n "$ACCESS_TOKEN" ] || [ -n "$API_KEY" ]; then | ||||||||||||
| echo "Starting ComputeSDK compute daemon (credentials found)..." | ||||||||||||
| curl -s http://127.0.0.1:8080/process \ | ||||||||||||
| -X POST \ | ||||||||||||
| -H "Content-Type: application/json" \ | ||||||||||||
| -d '{"name": "compute-daemon", "workingDir": "/app", "command": "/app/compute serve-daemon", "waitForCompletion": false}' | ||||||||||||
| else | ||||||||||||
| echo "WARNING: No COMPUTESDK_ACCESS_TOKEN or COMPUTESDK_API_KEY set." | ||||||||||||
| echo "The compute daemon will NOT start automatically." | ||||||||||||
| echo "Provide credentials at sandbox creation time, or start manually via:" | ||||||||||||
| echo " /app/compute serve-daemon --access-token <TOKEN>" | ||||||||||||
| fi | ||||||||||||
|
|
||||||||||||
| echo "ComputeSDK sandbox ready" | ||||||||||||
|
|
||||||||||||
| # Keep the container running | ||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. bug (P1): Suggested change
Suggested change
Prompt for AI agents |
||||||||||||
| wait | ||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| { | ||
| "name": "computesdk-image", | ||
| "displayName": "ComputeSDK", | ||
| "categories": [], | ||
| "description": "Sandbox environment with the ComputeSDK compute runtime pre-installed", | ||
| "longDescription": "A Blaxel sandbox image with the ComputeSDK compute runtime pre-installed. The compute daemon is started automatically during sandbox creation via the gateway provider.", | ||
| "memory": 4096, | ||
| "ports": [ | ||
| { | ||
| "name": "sandbox-api", | ||
| "target": 8080, | ||
| "protocol": "HTTP" | ||
| }, | ||
| { | ||
| "name": "compute", | ||
| "target": 18080, | ||
| "protocol": "HTTP" | ||
| } | ||
| ] | ||
| } |


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
security (P1): Unpinned external base image
computesdk/compute:latestis a supply chain risk. Any upstream change or compromise is silently pulled in on every build. Pin to a specific digest or version tag.Suggested change
Prompt for AI agents