diff --git a/.changeset/violet-needles-wait.md b/.changeset/violet-needles-wait.md new file mode 100644 index 00000000..88744bce --- /dev/null +++ b/.changeset/violet-needles-wait.md @@ -0,0 +1,5 @@ +--- +"@cloudflare/sandbox": patch +--- + +Debloat base docker image (2.63GB → 1.03GB) diff --git a/.github/changeset-version.ts b/.github/changeset-version.ts index 3421e1c7..3297f960 100644 --- a/.github/changeset-version.ts +++ b/.github/changeset-version.ts @@ -1,5 +1,6 @@ import { execSync } from "node:child_process"; import * as fs from "node:fs"; +import fg from "fast-glob"; // This script is used by the `release.yml` workflow to update the version of the packages being released. // The standard step is only to run `changeset version` but this does not update the package-lock.json file. @@ -13,41 +14,108 @@ execSync("npm install", { stdio: "inherit", }); -// Update Dockerfile and README version references after changeset updates package.json +// Update all version references across the codebase after changeset updates package.json try { const packageJson = JSON.parse(fs.readFileSync("./packages/sandbox/package.json", "utf-8")); const newVersion = packageJson.version; - const dockerfilePath = "./examples/basic/Dockerfile"; - let dockerfileContent = fs.readFileSync(dockerfilePath, "utf-8"); + console.log(`\nšŸ” Searching for version references to update to ${newVersion}...\n`); - // Update the production image version in the comment - dockerfileContent = dockerfileContent.replace( - /# FROM docker\.io\/cloudflare\/sandbox:[\d.]+/, - `# FROM docker.io/cloudflare/sandbox:${newVersion}` - ); + // Patterns to match version references in different contexts + const versionPatterns = [ + // Docker image versions (production and test) + { + pattern: /FROM docker\.io\/cloudflare\/sandbox:[\d.]+/g, + replacement: `FROM docker.io/cloudflare/sandbox:${newVersion}`, + description: "Production Docker image", + }, + { + pattern: /# FROM docker\.io\/cloudflare\/sandbox:[\d.]+/g, + replacement: `# FROM docker.io/cloudflare/sandbox:${newVersion}`, + description: "Commented production Docker image", + }, + { + pattern: /FROM cloudflare\/sandbox-test:[\d.]+/g, + replacement: `FROM cloudflare/sandbox-test:${newVersion}`, + description: "Test Docker image", + }, + { + pattern: /docker\.io\/cloudflare\/sandbox-test:[\d.]+/g, + replacement: `docker.io/cloudflare/sandbox-test:${newVersion}`, + description: "Test Docker image (docker.io)", + }, + // Image tags in docker commands + { + pattern: /cloudflare\/sandbox:[\d.]+/g, + replacement: `cloudflare/sandbox:${newVersion}`, + description: "Docker image reference", + }, + { + pattern: /cloudflare\/sandbox-test:[\d.]+/g, + replacement: `cloudflare/sandbox-test:${newVersion}`, + description: "Test Docker image reference", + }, + ]; - // Update the test image version - dockerfileContent = dockerfileContent.replace( - /FROM cloudflare\/sandbox-test:[\d.]+/, - `FROM cloudflare/sandbox-test:${newVersion}` - ); + // Files to search and update + const filePatterns = [ + "**/*.md", // All markdown files + "**/Dockerfile", // All Dockerfiles + "**/Dockerfile.*", // Dockerfile variants + "**/*.ts", // TypeScript files (for documentation comments) + "**/*.js", // JavaScript files + "**/*.json", // JSON configs (but not package.json/package-lock.json) + "**/*.yaml", // YAML configs + "**/*.yml", // YML configs + ]; - fs.writeFileSync(dockerfilePath, dockerfileContent); - console.log(`āœ… Updated Dockerfile versions to ${newVersion}`); + // Ignore patterns + const ignorePatterns = [ + "**/node_modules/**", + "**/dist/**", + "**/build/**", + "**/.git/**", + "**/package.json", // Don't modify package.json (changeset does this) + "**/package-lock.json", // Don't modify package-lock.json (npm install does this) + "**/.github/changeset-version.ts", // Don't modify this script itself + ]; - // Update README.md - const readmePath = "./README.md"; - let readmeContent = fs.readFileSync(readmePath, "utf-8"); + // Find all matching files + const files = await fg(filePatterns, { + ignore: ignorePatterns, + onlyFiles: true, + }); - // Update the Docker image version in README - readmeContent = readmeContent.replace( - /FROM docker\.io\/cloudflare\/sandbox:[\d.]+/, - `FROM docker.io/cloudflare/sandbox:${newVersion}` - ); + console.log(`šŸ“ Found ${files.length} files to check\n`); - fs.writeFileSync(readmePath, readmeContent); - console.log(`āœ… Updated README.md version to ${newVersion}`); + let updatedFilesCount = 0; + let totalReplacementsCount = 0; + + for (const file of files) { + let content = fs.readFileSync(file, "utf-8"); + let fileModified = false; + let fileReplacementsCount = 0; + + // Try all patterns on this file + for (const { pattern, replacement, description } of versionPatterns) { + const matches = content.match(pattern); + if (matches) { + content = content.replace(pattern, replacement); + fileModified = true; + fileReplacementsCount += matches.length; + } + } + + if (fileModified) { + fs.writeFileSync(file, content); + updatedFilesCount++; + totalReplacementsCount += fileReplacementsCount; + console.log(` āœ… ${file} (${fileReplacementsCount} replacement${fileReplacementsCount > 1 ? 's' : ''})`); + } + } + + console.log(`\n✨ Updated ${totalReplacementsCount} version reference${totalReplacementsCount !== 1 ? 's' : ''} across ${updatedFilesCount} file${updatedFilesCount !== 1 ? 's' : ''}`); + console.log(` New version: ${newVersion}\n`); } catch (error) { console.error("āŒ Failed to update file versions:", error); diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b95af03c..97284c25 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -64,79 +64,77 @@ jobs: run: npm run test -w @repo/sandbox-container # E2E tests run in parallel with unit tests - # e2e-tests: - # if: ${{ github.repository_owner == 'cloudflare' }} - # runs-on: ubuntu-latest - # timeout-minutes: 30 - - # steps: - # - uses: actions/checkout@v4 - - # - uses: actions/setup-node@v4 - # with: - # node-version: 24 - # cache: "npm" - - # - uses: oven-sh/setup-bun@v2 - # with: - # bun-version: latest - - # - name: Install dependencies - # run: npm ci - - # - name: Build packages - # run: npm run build - - # - name: Set worker name - # id: worker-name - # run: | - # # Use git SHA for unique, meaningful naming (not sequential run number) - # SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7) - # echo "worker_name=sandbox-e2e-test-worker-release-${SHORT_SHA}" >> $GITHUB_OUTPUT - - # # Generate unique wrangler config for this release - # - name: Generate wrangler config - # run: | - # cd tests/e2e/test-worker - # ./generate-config.sh ${{ steps.worker-name.outputs.worker_name }} - - # - name: Build test worker Docker image - # run: npm run docker:local -w @cloudflare/sandbox - - # - name: Deploy test worker - # uses: cloudflare/wrangler-action@v3 - # with: - # apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} - # accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - # command: deploy --name ${{ steps.worker-name.outputs.worker_name }} - # workingDirectory: tests/e2e/test-worker - - # - name: Get deployment URL - # id: get-url - # run: | - # echo "worker_url=https://${{ steps.worker-name.outputs.worker_name }}.agents-b8a.workers.dev" >> $GITHUB_OUTPUT - - # - name: Run E2E tests - # run: npx vitest run --config vitest.e2e.config.ts - # env: - # TEST_WORKER_URL: ${{ steps.get-url.outputs.worker_url }} - # CI: true - - # - name: Cleanup test deployment - # if: always() - # continue-on-error: true - # run: | - # cd tests/e2e/test-worker - # ../../../scripts/cleanup-test-deployment.sh ${{ steps.worker-name.outputs.worker_name }} - # env: - # CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} - # CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + e2e-tests: + if: ${{ github.repository_owner == 'cloudflare' }} + runs-on: ubuntu-latest + timeout-minutes: 30 + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 24 + cache: "npm" + + - uses: oven-sh/setup-bun@v2 + with: + bun-version: latest + + - name: Install dependencies + run: npm ci + + - name: Build packages + run: npm run build + + - name: Set worker name + id: worker-name + run: | + # Use git SHA for unique, meaningful naming (not sequential run number) + SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7) + echo "worker_name=sandbox-e2e-test-worker-release-${SHORT_SHA}" >> $GITHUB_OUTPUT + + # Generate unique wrangler config for this release + - name: Generate wrangler config + run: | + cd tests/e2e/test-worker + ./generate-config.sh ${{ steps.worker-name.outputs.worker_name }} + + - name: Build test worker Docker image + run: npm run docker:local -w @cloudflare/sandbox + + - name: Deploy test worker + uses: cloudflare/wrangler-action@v3 + with: + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + command: deploy --name ${{ steps.worker-name.outputs.worker_name }} + workingDirectory: tests/e2e/test-worker + + - name: Get deployment URL + id: get-url + run: | + echo "worker_url=https://${{ steps.worker-name.outputs.worker_name }}.agents-b8a.workers.dev" >> $GITHUB_OUTPUT + + - name: Run E2E tests + run: npx vitest run --config vitest.e2e.config.ts + env: + TEST_WORKER_URL: ${{ steps.get-url.outputs.worker_url }} + CI: true + + - name: Cleanup test deployment + if: always() + continue-on-error: true + run: | + cd tests/e2e/test-worker + ../../../scripts/cleanup-test-deployment.sh ${{ steps.worker-name.outputs.worker_name }} + env: + CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} + CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} # Prerelease publish - always runs after tests pass publish-prerelease: - needs: [unit-tests, - # e2e-tests - ] + needs: [unit-tests, e2e-tests] if: ${{ github.repository_owner == 'cloudflare' }} runs-on: ubuntu-latest timeout-minutes: 20 @@ -187,9 +185,7 @@ jobs: # Release publish - only runs if changesets exist publish-release: - needs: [unit-tests, - # e2e-tests - ] + needs: [unit-tests, e2e-tests] if: ${{ github.repository_owner == 'cloudflare' }} runs-on: ubuntu-latest timeout-minutes: 20 @@ -236,4 +232,4 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.SANDBOX_GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} - NPM_PUBLISH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} \ No newline at end of file + NPM_PUBLISH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} diff --git a/examples/basic/Dockerfile b/examples/basic/Dockerfile index c29a613b..2dca36ff 100644 --- a/examples/basic/Dockerfile +++ b/examples/basic/Dockerfile @@ -6,7 +6,7 @@ FROM cloudflare/sandbox-test:0.4.2 # On a mac, you might need to actively pick up the # arm64 build of the image. -# FROM --platform=linux/arm64 cloudflare/sandbox-test:0.1.3 +# FROM --platform=linux/arm64 cloudflare/sandbox-test:0.4.2 # Expose the ports you want to expose EXPOSE 8080 diff --git a/examples/code-interpreter/Dockerfile b/examples/code-interpreter/Dockerfile index 84ed9060..5f405c6e 100644 --- a/examples/code-interpreter/Dockerfile +++ b/examples/code-interpreter/Dockerfile @@ -1,9 +1,9 @@ # This image is unique to this repo, and you'll never need it. # Whenever you're integrating with sandbox SDK in your own project, # you should use the official image instead: -# FROM docker.io/cloudflare/sandbox:0.2.3 -FROM cloudflare/sandbox-test:0.2.3 +# FROM docker.io/cloudflare/sandbox:0.4.2 +FROM cloudflare/sandbox-test:0.4.2 # On a mac, you might need to actively pick up the # arm64 build of the image. -# FROM --platform=linux/arm64 cloudflare/sandbox-test:0.1.3 +# FROM --platform=linux/arm64 cloudflare/sandbox-test:0.4.2 diff --git a/examples/minimal/Dockerfile b/examples/minimal/Dockerfile index b23ac88b..a3acad99 100644 --- a/examples/minimal/Dockerfile +++ b/examples/minimal/Dockerfile @@ -1,4 +1,4 @@ -FROM docker.io/cloudflare/sandbox:0.3.6 +FROM docker.io/cloudflare/sandbox:0.4.2 # On a Mac with Apple Silicon, you might need to specify the platform: -# FROM --platform=linux/arm64 docker.io/cloudflare/sandbox:0.3.6 +# FROM --platform=linux/arm64 docker.io/cloudflare/sandbox:0.4.2 diff --git a/package-lock.json b/package-lock.json index 03b097c6..97adc881 100644 --- a/package-lock.json +++ b/package-lock.json @@ -622,7 +622,6 @@ "integrity": "sha512-2BCOP7TN8M+gVDj7/ht3hsaO/B/n5oDbiAyyvnRlNOs+u1o+JWNYTQrmpuNp1/Wq2gcFrI01JAW+paEKDMx/CA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@babel/code-frame": "^7.27.1", "@babel/generator": "^7.28.3", @@ -1513,8 +1512,7 @@ "resolved": "https://registry.npmjs.org/@cloudflare/workers-types/-/workers-types-4.20251011.0.tgz", "integrity": "sha512-gQpih+pbq3sP4uXltUeCSbPgZxTNp2gQd8639SaIbQMwgA6oJNHLhIART1fWy6DQACngiRzDVULA2x0ohmkGTQ==", "dev": true, - "license": "MIT OR Apache-2.0", - "peer": true + "license": "MIT OR Apache-2.0" }, "node_modules/@cspotcode/source-map-support": { "version": "0.8.1", @@ -3129,7 +3127,6 @@ "integrity": "sha512-d2L25Y4j+W3ZlNAeMKcy7yDsK425ibcAOO2t7aPTz6gNMH0z2GThtwENCDc0d/Pw9wgyRqE5Px1wkV7naz8ang==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "undici-types": "~7.13.0" } @@ -3139,7 +3136,6 @@ "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.0.tgz", "integrity": "sha512-1LOH8xovvsKsCBq1wnT4ntDUdCJKmnEakhsuoUSy6ExlHCkGP2hqnatagYTgFk6oeL0VU31u7SNjunPN+GchtA==", "license": "MIT", - "peer": true, "dependencies": { "csstype": "^3.0.2" } @@ -3267,7 +3263,6 @@ "integrity": "sha512-oukfKT9Mk41LreEW09vt45f8wx7DordoWUZMYdY/cyAk7w5TWkTRCNZYF7sX7n2wB7jyGAl74OxgwhPgKaqDMQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@vitest/utils": "3.2.4", "pathe": "^2.0.3", @@ -3283,7 +3278,6 @@ "integrity": "sha512-dEYtS7qQP2CjU27QBC5oUOxLE/v5eLkGqPE0ZKEIDGMs4vKWe7IjgLOeauHsR0D5YuuycGRO5oSRXnwnmA78fQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@vitest/pretty-format": "3.2.4", "magic-string": "^0.30.17", @@ -3312,7 +3306,6 @@ "integrity": "sha512-hGISOaP18plkzbWEcP/QvtRW1xDXF2+96HbEX6byqQhAUbiS5oH6/9JwW+QsQCIYON2bI6QZBF+2PvOmrRZ9wA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@vitest/utils": "3.2.4", "fflate": "^0.8.2", @@ -3613,7 +3606,6 @@ } ], "license": "MIT", - "peer": true, "dependencies": { "baseline-browser-mapping": "^2.8.9", "caniuse-lite": "^1.0.30001746", @@ -4520,7 +4512,6 @@ "integrity": "sha512-9RiGKvCwaqxO2owP61uQ4BgNborAQskMR6QusfWzQqv7AZOg5oGehdY2pRJMTKuwxd1IDBP4rSbI5lHzU7SMsQ==", "hasInstallScript": true, "license": "MIT", - "peer": true, "bin": { "esbuild": "bin/esbuild" }, @@ -6044,6 +6035,7 @@ "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", "license": "MIT", + "peer": true, "dependencies": { "js-tokens": "^3.0.0 || ^4.0.0" }, @@ -8292,7 +8284,6 @@ } ], "license": "MIT", - "peer": true, "dependencies": { "nanoid": "^3.3.11", "picocolors": "^1.1.1", @@ -8436,7 +8427,6 @@ "resolved": "https://registry.npmjs.org/react/-/react-19.2.0.tgz", "integrity": "sha512-tmbWg6W31tQLeB5cdIBOicJDJRR2KzXsV7uSK9iNfLWQ5bIZfxuPEHp7M8wiHyHnn0DD1i7w3Zmin0FtkrwoCQ==", "license": "MIT", - "peer": true, "engines": { "node": ">=0.10.0" } @@ -8458,7 +8448,8 @@ "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/react-katex": { "version": "3.1.0", @@ -10052,7 +10043,6 @@ "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=12" }, @@ -10243,7 +10233,6 @@ "integrity": "sha512-ytQKuwgmrrkDTFP4LjR0ToE2nqgy886GpvRSpU0JAnrdBYppuY5rLkRUYPU1yCryb24SsKBTL/hlDQAEFVwtZg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "esbuild": "~0.25.0", "get-tsconfig": "^4.7.5" @@ -10531,7 +10520,6 @@ "integrity": "sha512-Wj7/AMtE9MRnAXa6Su3Lk0LNCfqDYgfwVjwRFVum9U7wsto1imuHqk4kTm7Jni+5A0Hn7dttL6O/zjvUvoo+8A==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "defu": "^6.1.4", "exsolve": "^1.0.7", @@ -10752,7 +10740,6 @@ "integrity": "sha512-4nVGliEpxmhCL8DslSAUdxlB6+SMrhB0a1v5ijlh1xB1nEPuy1mxaHxysVucLHuWryAxLWg6a5ei+U4TLn/rFg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.5.0", @@ -10869,7 +10856,6 @@ "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=12" }, @@ -10883,7 +10869,6 @@ "integrity": "sha512-LUCP5ev3GURDysTWiP47wRRUpLKMOfPh+yKTx3kVIEiu5KOMeqzpnYNsKyOoVrULivR8tLcks4+lga33Whn90A==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@types/chai": "^5.2.2", "@vitest/expect": "3.2.4", @@ -11121,7 +11106,6 @@ "dev": true, "hasInstallScript": true, "license": "Apache-2.0", - "peer": true, "bin": { "workerd": "bin/workerd" }, @@ -11747,7 +11731,6 @@ "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==", "devOptional": true, "license": "MIT", - "peer": true, "engines": { "node": ">=10.0.0" }, diff --git a/packages/sandbox/Dockerfile b/packages/sandbox/Dockerfile index c47ac4cb..3fe70c9c 100644 --- a/packages/sandbox/Dockerfile +++ b/packages/sandbox/Dockerfile @@ -56,46 +56,27 @@ COPY --from=builder /app/tooling ./tooling RUN npm ci --production # ============================================================================ -# Stage 4: Runtime - Ubuntu 22.04 with full development environment +# Stage 4: Runtime - Ubuntu 22.04 with only runtime dependencies # ============================================================================ FROM ubuntu:22.04 AS runtime # Prevent interactive prompts during package installation ENV DEBIAN_FRONTEND=noninteractive -# Install essential system packages and development tools -RUN apt-get update && apt-get install -y \ - # Basic utilities +# Install essential runtime packages +RUN apt-get update && apt-get install -y --no-install-recommends \ curl \ wget \ + ca-certificates \ + python3.11 \ + python3-pip \ + python3.11-venv \ + procps \ git \ unzip \ zip \ - file \ - # Process management - procps \ - htop \ - # Build tools - build-essential \ - pkg-config \ - # Network tools - net-tools \ - iputils-ping \ - dnsutils \ - # Text processing jq \ - vim \ - nano \ - # Python dependencies - python3.11 \ - python3.11-dev \ - python3-pip \ - python3.11-venv \ - # Other useful tools - ca-certificates \ - gnupg \ - lsb-release \ - strace \ + file \ && rm -rf /var/lib/apt/lists/* # Set Python 3.11 as default python3 @@ -108,13 +89,6 @@ RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \ # Install Bun runtime from official image COPY --from=oven/bun:1 /usr/local/bin/bun /usr/local/bin/bun -COPY --from=oven/bun:1 /usr/local/bin/bunx /usr/local/bin/bunx - -# Install development tools globally -RUN npm install -g \ - wrangler \ - vite \ - opencode-ai # Install essential Python packages for code execution RUN pip3 install --no-cache-dir \ @@ -123,12 +97,6 @@ RUN pip3 install --no-cache-dir \ pandas \ ipython -# Verify installations -RUN python3 --version && \ - node --version && \ - npm --version && \ - bun --version - # Set up runtime container server directory WORKDIR /container-server @@ -143,10 +111,9 @@ COPY --from=builder /app/packages/sandbox-container/src/runtime/executors/python # Includes: @repo/shared, zod, esbuild (runtime dependencies) COPY --from=prod-deps /app/node_modules ./node_modules -# Copy workspace packages so node_modules symlinks work -# @repo/shared and @repo/typescript-config are symlinked in node_modules -COPY --from=prod-deps /app/packages/shared ./packages/shared -COPY --from=prod-deps /app/tooling/typescript-config ./tooling/typescript-config +# Copy workspace packages +COPY --from=prod-deps /app/packages/shared/dist ./packages/shared/dist +COPY --from=prod-deps /app/packages/shared/package.json ./packages/shared/package.json # Configure process pool sizes (can be overridden at runtime) ENV PYTHON_POOL_MIN_SIZE=3 @@ -157,9 +124,6 @@ ENV TYPESCRIPT_POOL_MIN_SIZE=3 ENV TYPESCRIPT_POOL_MAX_SIZE=10 # Create clean workspace directory for user code -# Architecture: -# /container-server/ - SDK infrastructure (server, executors, dependencies) -# /workspace/ - User's clean workspace for their code RUN mkdir -p /workspace # Expose the application port (3000 for control) diff --git a/packages/sandbox/src/sandbox.ts b/packages/sandbox/src/sandbox.ts index d887e8e6..8b2318bf 100644 --- a/packages/sandbox/src/sandbox.ts +++ b/packages/sandbox/src/sandbox.ts @@ -110,7 +110,6 @@ export class Sandbox extends Container implements ISandbox { if (!this.baseUrl) { this.baseUrl = baseUrl; await this.ctx.storage.put('baseUrl', baseUrl); - console.log(`[Sandbox] Stored base URL: ${baseUrl}`); } else { if(this.baseUrl !== baseUrl) { throw new Error('Base URL already set and different from one previously provided'); diff --git a/tests/e2e/test-worker/Dockerfile b/tests/e2e/test-worker/Dockerfile index 8cfac9ca..893c360c 100644 --- a/tests/e2e/test-worker/Dockerfile +++ b/tests/e2e/test-worker/Dockerfile @@ -1,5 +1,5 @@ # Integration test Dockerfile -FROM docker.io/cloudflare/sandbox-test:0.3.3 +FROM docker.io/cloudflare/sandbox-test:0.4.2 # Expose ports used for testing EXPOSE 8080 diff --git a/tests/e2e/test-worker/wrangler.template.jsonc b/tests/e2e/test-worker/wrangler.template.jsonc index f955626a..27a97d98 100644 --- a/tests/e2e/test-worker/wrangler.template.jsonc +++ b/tests/e2e/test-worker/wrangler.template.jsonc @@ -17,8 +17,7 @@ { "class_name": "Sandbox", "image": "./Dockerfile", - "name": "{{CONTAINER_NAME}}", - "instance_type": "standard-1" + "name": "{{CONTAINER_NAME}}" } ],