diff --git a/packages/at-run/runner/Dockerfile b/packages/at-run/runner/Dockerfile index 14525e8..5965a72 100644 --- a/packages/at-run/runner/Dockerfile +++ b/packages/at-run/runner/Dockerfile @@ -1,11 +1,5 @@ # at-run runner Dockerfile -FROM oven/bun:1 AS base - -# Install curl, ffmpeg, and Deno -RUN apt-get update && apt-get install -y curl ffmpeg unzip \ - && curl -fsSL https://deno.land/install.sh | DENO_INSTALL=/usr/local sh \ - && deno --version \ - && rm -rf /var/lib/apt/lists/* +FROM oven/bun:1 AS builder WORKDIR /app @@ -24,11 +18,30 @@ RUN bun install COPY packages/at-run/runtime ./packages/at-run/runtime COPY packages/at-run/runner ./packages/at-run/runner +# Build bundled runner (includes @at-run/runtime) WORKDIR /app/packages/at-run/runner +RUN bun run build + +# Runtime stage +FROM oven/bun:1 AS runtime + +# Install Deno for sandbox execution +RUN apt-get update && apt-get install -y curl unzip \ + && curl -fsSL https://deno.land/install.sh | DENO_INSTALL=/usr/local sh \ + && deno --version \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /app + +# Copy bundled runner and better-sqlite3 (native dep for job scheduler) +COPY --from=builder /app/packages/at-run/runner/dist/index.js ./index.js +COPY --from=builder /app/node_modules/better-sqlite3 ./node_modules/better-sqlite3 +COPY --from=builder /app/node_modules/bindings ./node_modules/bindings +COPY --from=builder /app/node_modules/file-uri-to-path ./node_modules/file-uri-to-path # Expose port ENV PORT=3000 EXPOSE 3000 -# Run the server -CMD ["bun", "run", "src/index.ts"] +# Run the bundled server +CMD ["bun", "run", "index.js"] diff --git a/packages/at-run/runner/package.json b/packages/at-run/runner/package.json index e6be557..079ba9c 100644 --- a/packages/at-run/runner/package.json +++ b/packages/at-run/runner/package.json @@ -9,8 +9,9 @@ }, "scripts": { "dev": "DEV=true bun run --watch src/index.ts", - "start": "bun run src/index.ts", - "build": "bun build src/index.ts --compile --outfile=at-run-runner" + "start": "bun run dist/index.js", + "build": "bun build src/index.ts --bundle --outfile=dist/index.js --target=bun --external better-sqlite3", + "build:binary": "bun build src/index.ts --compile --outfile=at-run-runner" }, "dependencies": { "@at-run/runtime": "workspace:*",