# Stage 1: Builder - install Bun and build the CLI from source
FROM debian:bookworm-slim AS builder
# Install required tools for building
RUN apt-get update \
&& apt-get install -y --no-install-recommends curl ca-certificates git \
&& rm -rf /var/lib/apt/lists/*
# Install Bun (used for building in this monorepo)
ENV BUN_INSTALL=/root/.bun
ENV PATH="${BUN_INSTALL}/bin:${PATH}"
RUN curl -fsSL https://bun.sh/install | bash
WORKDIR /workspace
# Copy repository and install dependencies
COPY . .
RUN bun install --frozen-lockfile
# Build the CLI app from source
WORKDIR /workspace/apps/cli
RUN bun run build
# Stage 2: Runtime - use a slim Node image and run the built CLI
FROM node:20-slim
WORKDIR /app
# Copy the built distribution from the builder
COPY --from=builder /workspace/apps/cli/dist /app/cli-dist
# Run the CLI binary when the container starts
CMD ["node", "/app/cli-dist/cli.mjs"]
# Ignore source control and dependencies to keep context small .git node_modules bower_components .dockerignore .bunfig.toml .env *.log .vscode/ *.log coverage/ dist/ build/ .idea/ .DS_Store
# Ignore source control and dependencies to keep context small .git node_modules bower_components .dockerignore .bunfig.toml .env *.log .vscode/ *.log coverage/ dist/ build/ .idea/ .DS_Store
Summary (under 1500 chars): - Exact error message and exit code - error: unzip is required to install bun - exit code: 1 - Failing command/step - [builder 3/8] RUN curl -fsSL https://bun.sh/install | bash - Missing packages or files mentioned - unzip is required to install bun but is not installed in the image - Version mismatch info - Base images involved: Debian bookworm-slim and Node:20-slim; no explicit version mismatch noted - Context note - The bun installer fails due to missing unzip, causing the overall build to fail at the bun installation step. Possible fix (brief) - Install unzip before running bun install, e.g., add a step to install unzip (apt-get update && apt-get install -y unzip) prior to the bun installer.
# Stage 1: Builder - install Bun and build the CLI from source
FROM debian:bookworm-slim AS builder
# Install required tools for building
RUN apt-get update \
&& apt-get install -y --no-install-recommends curl ca-certificates unzip git \
&& rm -rf /var/lib/apt/lists/*
# Install Bun (used for building in this monorepo)
ENV BUN_INSTALL=/root/.bun
ENV PATH="${BUN_INSTALL}/bin:${PATH}"
RUN curl -fsSL https://bun.sh/install | bash
WORKDIR /workspace
# Copy repository and install dependencies
COPY . .
RUN bun install --frozen-lockfile
# Build the CLI app from source
WORKDIR /workspace/apps/cli
RUN bun run build
# Stage 2: Runtime - use a slim Node image and run the built CLI from source
FROM node:20-slim
WORKDIR /app
# Copy the built distribution from the builder
COPY --from=builder /workspace/apps/cli/dist /app/cli-dist
# Run the CLI binary when the container starts
CMD ["node", "/app/cli-dist/cli.mjs"]
- Failing step
- RUN bun install --frozen-lockfile (builder 6/8)
- Exact error message and exit code
- exit code: 128
- bun install v1.3.11 (af24e281)
- 8.896
- 8.896 $ lefthook install
- 8.929 exit status 128
- 8.929 │ > git rev-parse --path-format=absolute --show-toplevel --git-path hooks --git-path info --git-dir
- 8.929 │ fatal: not a git repository (or any of the parent directories): .git
- 8.929 │
- 8.933 error: prepare script from "better-t-stack" exited with 1
- Failing command/step details
- Command: bun install --frozen-lockfile
- Inside it runs lefthook install, which fails with exit status 128 due to a git rev-parse failure
- Missing packages/files mentioned
- Error indicates the repository is not a Git repository:
- fatal: not a git repository (or any of the parent directories): .git
- This implies the build context does not contain a .git directory, so lefthook cannot locate the Git metadata required by the prepare script (better-t-stack)
- Version/mismatch information
- bun version: v1.3.11 (af24e281)
- No explicit version mismatch shown for base images or dependencies (Node: 20-slim, Debian bookworm-slim) in this snippet; the failure is due to missing Git repository metadata rather than a version clash.No results found.
Error: file not found: apps/cli/.bunfig.toml
No files found matching pattern.
# Stage 1: Builder - install Bun and build the CLI from source
FROM debian:bookworm-slim AS builder
# Install required tools for building
RUN apt-get update \
&& apt-get install -y --no-install-recommends curl ca-certificates unzip git \
&& rm -rf /var/lib/apt/lists/*
# Install Bun (used for building in this monorepo)
ENV BUN_INSTALL=/root/.bun
ENV PATH="${BUN_INSTALL}/bin:${PATH}"
RUN curl -fsSL https://bun.sh/install | bash
WORKDIR /workspace
# Copy repository and install dependencies
COPY . .
# Workaround: disable Lefthook prepare script if present to avoid requiring a real .git repo during docker build
RUN if [ -f package.json ]; then \
echo "Patching prepare script in package.json"; \
sed -i -e 's/,"prepare": "lefthook install"//' \
-e 's/"prepare": "lefthook install",//' \
-e 's/"prepare": "lefthook install"//' \
package.json; \
fi
RUN bun install --frozen-lockfile
# Build the CLI app from source
WORKDIR /workspace/apps/cli
RUN bun run build
# Stage 2: Runtime - use a slim Node image and run the built CLI from source
FROM node:20-slim
WORKDIR /app
# Copy the built distribution from the builder
COPY --from=builder /workspace/apps/cli/dist /app/cli-dist
# Run the CLI binary when the container starts
CMD ["node", "/app/cli-dist/cli.mjs"]
Concerns: The patch to package.json relies on sed removing specific prepare script patterns; if the actual script differs or formatting varies, the patch may not apply as intended., The runtime CMD assumes the build outputs a file at /app/cli-dist/cli.mjs; if the build output structure changes, the container may fail to start.
Smoke [FAIL]: test -f /app/cli-dist/cli.mjs && echo 'cli.mjs found
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: node /app/cli-dist/cli.mjs --version
Output: node:internal/modules/esm/resolve:873
throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), null);
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'zod' imported from /app/cli-dist/cli.mjs
at packageResolve (node:internal/modules/esm/resolve:873:9)
at moduleResolve (node:internal/modules/esm/resolve:946:18)
at defaultResolve (node:internal/modules/esm/resolve:1188:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:708:12)
at #cached# Stage 1: Builder - install Bun and build the CLI from source
FROM debian:bookworm-slim AS builder
# Install required tools for building
RUN apt-get update \
&& apt-get install -y --no-install-recommends curl ca-certificates unzip git \
&& rm -rf /var/lib/apt/lists/*
# Install Bun (used for building in this monorepo)
ENV BUN_INSTALL=/root/.bun
ENV PATH="${BUN_INSTALL}/bin:${PATH}"
RUN curl -fsSL https://bun.sh/install | bash
WORKDIR /workspace
# Copy repository and prepare for build
COPY . .
# Workaround: provide a minimal .git directory so lefthook can run without a real git repo
RUN mkdir -p /workspace/.git/refs/heads/main \
&& printf "ref: refs/heads/main" > /workspace/.git/HEAD \
&& mkdir -p /workspace/.git/logs
# Run install and build
RUN bun install --frozen-lockfile
# Build the CLI app from source
WORKDIR /workspace/apps/cli
RUN bun run build
# Stage 2: Runtime - use a slim Node image and run the built CLI from source
FROM node:20-slim
WORKDIR /app
# Copy the built distribution and node_modules from the builder
COPY --from=builder /workspace/apps/cli/dist /app/cli-dist
COPY --from=builder /workspace/node_modules /app/node_modules
# Run the CLI binary when the container starts
CMD ["node", "/app/cli-dist/cli.mjs"]
Failing step (command): - [builder 7/9] RUN bun install --frozen-lockfile Exact error message and exit code: - fatal: not a git repository (or any of the parent directories): .git - exit status 128 - error: prepare script from "better-t-stack" exited with 1 - Docker: process "/bin/sh -c bun install --frozen-lockfile" did not complete successfully: exit code: 1 Context of failure: - bun install --frozen-lockfile triggers lefthook install, which runs: - $ git rev-parse --path-format=absolute --show-toplevel --git-path hooks --git-path info --git-dir - fatal: not a git repository (or any of the parent directories): .git Missing packages/files mentioned: - The failure indicates the build context lacks a .git repository (no .git directory), causing the lefthook/prepare script to fail since it expects a Git repo. Version and environment details: - bun install v1.3.11 (af24e281) - Node:20-slim base image (stage-1) - Bundled tools: lefthook is invoked during bun install - Base images in use: - From debian:bookworm-slim - From node:20-slim Notes: - The root cause is the absence of a Git repository in the build context, causing lefthook’s prepare script to fail with exit code 128, which leads bun install to fail (exit code 1).
# Stage 1: Builder - install Bun and build the CLI from source
FROM debian:bookworm-slim AS builder
# Install required tools for building
RUN apt-get update \
&& apt-get install -y --no-install-recommends curl ca-certificates unzip git \
&& rm -rf /var/lib/apt/lists/*
# Install Bun (used for building in this monorepo)
ENV BUN_INSTALL=/root/.bun
ENV PATH="${BUN_INSTALL}/bin:${PATH}"
RUN curl -fsSL https://bun.sh/install | bash
WORKDIR /workspace
# Copy repository and prepare for build
COPY . .
# Initialize a git repository to satisfy Lefthook during bun install in non-git contexts
RUN git init
# Run install and build
RUN bun install --frozen-lockfile
# Build the CLI app from source
WORKDIR /workspace/apps/cli
RUN bun run build
# Stage 2: Runtime - use a slim Node image and run the built CLI from source
FROM node:20-slim
WORKDIR /app
# Copy the built distribution and node_modules from the builder
COPY --from=builder /workspace/apps/cli/dist /app/cli-dist
COPY --from=builder /workspace/node_modules /app/node_modules
# Run the CLI binary when the container starts
CMD ["node", "/app/cli-dist/cli.mjs"]
Concerns: Potential runtime mismatch: The build uses Bun to generate dist, but the runtime stage uses Node 20 to execute /app/cli-dist/cli.mjs. Ensure the produced dist is Node-compatible (no Bun-specific runtime features) or bundle appropriately for Node., Copying /workspace/node_modules from the Bun build into the Node runtime may not always be reliable across environments (Bun and Node can organize dependencies differently, and native modules may be platform-specific). Consider bundling or re-installing dependencies in the final image if issues arise. Smoke [FAIL]: test -f /app/cli-dist/cli.mjs Output: Timed out after 30s Smoke [FAIL]: node -v Output: Timed out after 30s Smoke [FAIL]: node /app/cli-dist/cli.mjs --version || true Output: Timed out after 30s
# Stage 1: Builder - install Bun and build the CLI from source
FROM debian:bookworm-slim AS builder
# Install required tools for building
RUN apt-get update \
&& apt-get install -y --no-install-recommends curl ca-certificates unzip git \
&& rm -rf /var/lib/apt/lists/*
# Install Bun (used for building in this monorepo)
ENV BUN_INSTALL=/root/.bun
ENV PATH="${BUN_INSTALL}/bin:${PATH}"
RUN curl -fsSL https://bun.sh/install | bash
WORKDIR /workspace
# Copy repository and prepare for build
COPY . .
# Initialize a git repository to satisfy Lefthook during bun install in non-git contexts
RUN git init && git add -A && git commit -m "initial commit" || true
# Run install and build
RUN bun install --frozen-lockfile
# Build the CLI app from source
WORKDIR /workspace/apps/cli
RUN bun run build
# Stage 2: Runtime - use a slim image and run the built CLI with Bun runtime
FROM debian:bookworm-slim
# Install Bun and dependencies in the runtime image to execute the built CLI
RUN apt-get update \
&& apt-get install -y --no-install-recommends curl ca-certificates unzip \
&& rm -rf /var/lib/apt/lists/*
ENV BUN_INSTALL=/root/.bun
ENV PATH="${BUN_INSTALL}/bin:${PATH}"
RUN curl -fsSL https://bun.sh/install | bash
WORKDIR /app
# Copy the built distribution and node_modules from the builder
COPY --from=builder /workspace/apps/cli/dist /app/cli-dist
COPY --from=builder /workspace/node_modules /app/node_modules
# Run the CLI binary when the container starts (use Bun runtime)
CMD ["bun", "/app/cli-dist/cli.mjs"]
Concerns: Final image copies node_modules from the builder; this may bloat the runtime image if node_modules contains dev dependencies., The build relies on bun install with --frozen-lockfile; ensure bun.lockb exists and Bun version compatibility is maintained., No explicit .dockerignore shown; build context may include large files leading to longer build times. Smoke [PASS]: bun -v Smoke [FAIL]: test -f /app/cli-dist/cli.mjs && echo 'artifact exists' || echo 'artifact missing Output: sh: 1: Syntax error: Unterminated quoted string Smoke [FAIL]: bun /app/cli-dist/cli.mjs --version 2>&1 | head -n 1 || echo 'version flag not supported Output: sh: 1: Syntax error: Unterminated quoted string
# Stage 1: Builder - install Bun and build the CLI from source
FROM debian:bookworm-slim AS builder
# Install required tools for building
RUN apt-get update \
&& apt-get install -y --no-install-recommends curl ca-certificates unzip git \
&& rm -rf /var/lib/apt/lists/*
# Install Bun (used for building in this monorepo)
ENV BUN_INSTALL=/root/.bun
ENV PATH="${BUN_INSTALL}/bin:${PATH}"
RUN curl -fsSL https://bun.sh/install | bash
WORKDIR /workspace
# Copy repository and prepare for build
COPY . .
# Initialize a git repository to satisfy Lefthook during bun install in non-git contexts
RUN git init && git add -A && git commit -m "initial commit" || true
# Run install and build
RUN bun install --frozen-lockfile
# Build the CLI app from source
WORKDIR /workspace/apps/cli
RUN bun run build
# Stage 2: Runtime - use a slim image with Bun installed and run the built CLI
FROM debian:bookworm-slim
# Install Bun in runtime image
RUN apt-get update \
&& apt-get install -y --no-install-recommends curl ca-certificates unzip \
&& rm -rf /var/lib/apt/lists/*
ENV BUN_INSTALL=/root/.bun
ENV PATH="${BUN_INSTALL}/bin:${PATH}"
RUN curl -fsSL https://bun.sh/install | bash
# Copy bun and built artifacts from builder
COPY --from=builder /root/.bun /root/.bun
COPY --from=builder /workspace/apps/cli/dist /app/cli-dist
WORKDIR /app
# Run the CLI binary when the container starts using Bun runtime
CMD ["/bin/sh", "-c", "bun /app/cli-dist/cli.mjs"]
Concerns: No HEALTHCHECK defined; consider adding for liveness/readiness (optional)., Assumes build output goes to /workspace/apps/cli/dist; if the build output path changes, update the COPY in the final stage. Smoke [PASS]: test -f /app/cli-dist/cli.mjs && echo 'CLI dist present' || exit 1 Smoke [FAIL]: bun -v && echo 'bun runtime available Output: sh: 1: Syntax error: Unterminated quoted string Smoke [FAIL]: bun /app/cli-dist/cli.mjs --version Output: error: ENOENT while resolving package '@trpc/server' from '/app/cli-dist/src-Cxn2wMWz.mjs' Bun v1.3.11 (Linux x64)
# Stage 1: Builder - install Bun and build the CLI from source
FROM debian:bookworm-slim AS builder
# Install required tools for building
RUN apt-get update \
&& apt-get install -y --no-install-recommends curl ca-certificates unzip git \
&& rm -rf /var/lib/apt/lists/*
# Install Bun (used for building in this monorepo)
ENV BUN_INSTALL=/root/.bun
ENV PATH="${BUN_INSTALL}/bin:${PATH}"
RUN curl -fsSL https://bun.sh/install | bash
WORKDIR /workspace
# Copy repository into the image
COPY . .
# Initialize a git repository to satisfy Lefthook during bun install in non-git contexts
RUN git init && git add -A && git commit -m "initial commit" --allow-empty
# Run install and build
RUN bun install --frozen-lockfile
# Build the CLI app from source
WORKDIR /workspace/apps/cli
RUN bun run build
# Stage 2: Runtime - use a slim Node image and run the built CLI from source
FROM node:20-slim
WORKDIR /app
# Copy the built distribution from the builder
COPY --from=builder /workspace/apps/cli/dist /app/cli-dist
# Run the CLI binary when the container starts
CMD ["node", "/app/cli-dist/cli.mjs"]
- Exact error message and exit code
- fatal: unable to auto-detect email address (got 'root@buildkitsandbox.(none)')
- Exit code: 128
- Failing command/step
- RUN git init && git add -A && git commit -m "initial commit" --allow-empty
- Location: [builder 6/9] in Dockerfile
- Missing packages or files mentioned
- None explicitly missing. The log shows Git cannot determine user identity (email/name) and prompts to configure:
- git config --global user.email "you@example.com"
- git config --global user.name "Your Name"
- Version mismatch info
- No version mismatch reported. Base images in use:
- Debian:bookworm-slim
- Node:20-slim
- The failure occurs during the git commit step, not due to a base image version issue.# Stage 1: Builder - install Bun and build the CLI from source
FROM debian:bookworm-slim AS builder
# Install required tools for building
RUN apt-get update \
&& apt-get install -y --no-install-recommends curl ca-certificates unzip git \
&& rm -rf /var/lib/apt/lists/*
# Install Bun (used for building in this monorepo)
ENV BUN_INSTALL=/root/.bun
ENV PATH="${BUN_INSTALL}/bin:${PATH}"
RUN curl -fsSL https://bun.sh/install | bash
WORKDIR /workspace
# Copy repository into the image
COPY . .
# Initialize a git repository to satisfy Lefthook during bun install in non-git contexts
RUN git init
RUN git config user.name "CI" \
&& git config user.email ci@example.com
# Run install and build
RUN bun install --frozen-lockfile
# Build the CLI app from source
WORKDIR /workspace/apps/cli
RUN bun run build
# Stage 2: Runtime - use a slim Node image and run the built CLI from source
FROM node:20-slim
WORKDIR /app
# Copy the built distribution from the builder
COPY --from=builder /workspace/apps/cli/dist /app/cli-dist
# Run the CLI binary when the container starts
CMD ["node", "/app/cli-dist/cli.mjs"]
Concerns: Unclear if bun build reliably outputs an entry point at /workspace/apps/cli/dist/cli.mjs and if the runtime CMD path /app/cli-dist/cli.mjs matches the actual built artifact., No explicit tests for environment consistency (e.g., required dependencies or environment variables) beyond the basic presence of the dist file.
Smoke [PASS]: test -f /app/cli-dist/cli.mjs
Smoke [FAIL]: node /app/cli-dist/cli.mjs --version
Output: node:internal/modules/esm/resolve:873
throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), null);
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'zod' imported from /app/cli-dist/cli.mjs
at packageResolve (node:internal/modules/esm/resolve:873:9)
at moduleResolve (node:internal/modules/esm/resolve:946:18)
at defaultResolve (node:internal/modules/esm/resolve:1188:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:708:12)
at #cached# Stage 1: Builder - install Bun and build the CLI from source
FROM debian:bookworm-slim AS builder
# Install required tools for building
RUN apt-get update \
&& apt-get install -y --no-install-recommends curl ca-certificates unzip git \
&& rm -rf /var/lib/apt/lists/*
# Install Bun (used for building in this monorepo)
ENV BUN_INSTALL=/root/.bun
ENV PATH="${BUN_INSTALL}/bin:${PATH}"
RUN curl -fsSL https://bun.sh/install | bash
WORKDIR /workspace
# Copy repository into the image
COPY . .
# Initialize a git repository to satisfy Lefthook during bun install in non-git contexts
RUN git init && git config user.name "CI" \
&& git config user.email ci@example.com \
&& git commit --allow-empty -m "initial" || true
# Run install and build
RUN bun install --frozen-lockfile
# Build the CLI app from source
WORKDIR /workspace/apps/cli
RUN bun run build
# Stage 2: Runtime - use a slim image with Bun installed and run the built CLI
FROM debian:bookworm-slim
# Install Bun in runtime image
RUN apt-get update \
&& apt-get install -y --no-install-recommends curl ca-certificates unzip \
&& rm -rf /var/lib/apt/lists/*
ENV BUN_INSTALL=/root/.bun
ENV PATH="${BUN_INSTALL}/bin:${PATH}"
RUN curl -fsSL https://bun.sh/install | bash
WORKDIR /workspace
# Copy the Bun runtime and built artifacts from the builder
COPY --from=builder /root/.bun /root/.bun
COPY --from=builder /workspace/apps/cli/dist /workspace/apps/cli/dist
COPY --from=builder /workspace/node_modules /workspace/node_modules
# Run the CLI binary when the container starts (using Bun runtime)
CMD ["bun", "/workspace/apps/cli/dist/cli.mjs"]
Concerns: The build relies on bun install producing a root-level node_modules directory; if bun changes its layout, the runtime COPY may break., The final CMD assumes the built CLI exposes a --version flag; if the CLI changes its argument conventions, the smoke test by version may fail at runtime. Smoke [PASS]: test -f /workspace/apps/cli/dist/cli.mjs Smoke [PASS]: bun --version Smoke [FAIL]: bun /workspace/apps/cli/dist/cli.mjs --version Output: error: Cannot find package 'zod' from '/workspace/apps/cli/dist/cli.mjs' Bun v1.3.11 (Linux x64)
# syntax=docker/dockerfile:1
# Builder stage: install Bun, install dependencies and build the CLI from source
FROM debian:bookworm-slim AS builder
ENV DEBIAN_FRONTEND=noninteractive
# Install essential tools
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
curl \
git \
tzdata \
ca-certificates \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Install Bun (JavaScript/TypeScript runtime and package manager)
ENV BUN_INSTALL=/root/.bun
ENV PATH="${BUN_INSTALL}/bin:${PATH}"
RUN curl -fsSL https://bun.sh/install | bash
WORKDIR /app
COPY . .
# Disable prepare scripts that might rely on git in the build stage
RUN bun pm disable-script prepare || true
# Install dependencies for the whole monorepo
RUN bun install --frozen-lockfile
# Build the CLI (output expected under apps/cli/dist)
WORKDIR /app/apps/cli
RUN bun run build
# Simple sanity check for build output
RUN [ -f dist/cli.mjs ] || (echo "Expected output dist/cli.mjs not found" && exit 1)
# Runtime stage: Node 20 as the execution environment
FROM node:20-slim AS runtime
ENV NODE_ENV=production
WORKDIR /app
# Copy built CLI artifacts from the builder stage
COPY --from=builder /app/apps/cli/dist /app/dist
# Create a non-root user for security
RUN useradd -m appuser
USER appuser
# Entrypoint: run the built CLI
CMD ["node", "/app/dist/cli.mjs"]
node_modules .git dist *.log .env
Summary (under 1500 chars) - Exact error message and exit code - error: unzip is required to install bun - exit code: 1 - Failing command/step - Builder step: [builder 3/10] - Command: RUN curl -fsSL https://bun.sh/install | bash - Dockerfile location shown: Dockerfile:22 - Missing packages or files mentioned - unzip is not installed in the image; bun installation requires unzip - Version mismatch info - None reported. The failure is due to missing unzip, not a version conflict.
# syntax=docker/dockerfile:1
# Builder stage: install Bun, install dependencies and build the CLI from source
FROM debian:bookworm-slim AS builder
ENV DEBIAN_FRONTEND=noninteractive
# Install essential tools
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
curl \
git \
tzdata \
unzip \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Install Bun (JavaScript/TypeScript runtime and package manager)
ENV BUN_INSTALL=/root/.bun
ENV PATH="${BUN_INSTALL}/bin:${PATH}"
RUN curl -fsSL https://bun.sh/install | bash
WORKDIR /app
COPY . .
# Disable prepare scripts that might rely on git in the build stage
RUN bun pm disable-script prepare || true
# Install dependencies for the whole monorepo
RUN bun install --frozen-lockfile
# Build the CLI (output expected under apps/cli/dist)
WORKDIR /app/apps/cli
RUN bun run build
# Simple sanity check for build output
RUN [ -f dist/cli.mjs ] || (echo "Expected output dist/cli.mjs not found" && exit 1)
# Runtime stage: Node 20 as the execution environment
FROM node:20-slim AS runtime
ENV NODE_ENV=production
WORKDIR /app
# Copy built CLI artifacts from the builder stage
COPY --from=builder /app/apps/cli/dist /app/dist
# Create a non-root user for security
RUN useradd -m appuser
USER appuser
# Entrypoint: run the built CLI
CMD ["node", "/app/dist/cli.mjs"]
Summary of Docker build error - Failing step (command): Dockerfile: RUN bun install --frozen-lockfile (builder step 7/10) - Exact error message and exit code (from the run): bun install v1.3.11 (af24e281) Resolving dependencies Resolved, downloaded and extracted [152] $ lefthook install exit status 128 > git rev-parse --path-format=absolute --show-toplevel --git-path hooks --git-path info --git-dir fatal: not a git repository (or any of the parent directories): .git error: prepare script from "better-t-stack" exited with 1 Build termination note: ERROR: failed to build: failed to solve: process "/bin/sh -c bun install --frozen-lockfile" did not complete successfully: exit code: 1 - Missing packages or files mentioned: - The error arises because the lefthook prepare script expects a git repository, but there is no .git directory available (fatal: not a git repository ...). This indicates the build context is not a git repository during the bun install step. - Version mismatch info: - bun version: v1.3.11 (af24e281) - No explicit version mismatch reported; failure is due to the git repository expectation during lefthook’s prepare script rather than a version mismatch.
# syntax=docker/dockerfile:1
# Builder stage: install Bun, install dependencies and build the CLI from source
FROM debian:bookworm-slim AS builder
ENV DEBIAN_FRONTEND=noninteractive
# Install essential tools
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
curl \
git \
tzdata \
unzip \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Install Bun (JavaScript/TypeScript runtime and package manager)
ENV BUN_INSTALL=/root/.bun
ENV PATH="${BUN_INSTALL}/bin:${PATH}"
RUN curl -fsSL https://bun.sh/install | bash
WORKDIR /app
COPY . .
# Initialize a git repository to satisfy lefthook/bun prepare steps during install
RUN git init
# Disable prepare scripts that might rely on git in the build stage
RUN bun pm disable-script prepare || true
# Install dependencies for the whole monorepo
RUN bun install --frozen-lockfile
# Build the CLI (output expected under apps/cli/dist)
WORKDIR /app/apps/cli
RUN bun run build
# Simple sanity check for build output
RUN [ -f dist/cli.mjs ] || (echo "Expected output dist/cli.mjs not found" && exit 1)
# Runtime stage: Node 20 as the execution environment
FROM node:20-slim AS runtime
ENV NODE_ENV=production
WORKDIR /app
# Copy built CLI artifacts from the builder stage
COPY --from=builder /app/apps/cli/dist /app/dist
# Create a non-root user for security
RUN useradd -m appuser
USER appuser
# Entrypoint: run the built CLI
CMD ["node", "/app/dist/cli.mjs"]
Smoke [FAIL]: test -f /app/dist/cli.mjs && (node /app/dist/cli.mjs --version || node /app/dist/cli.mjs --help)
Output: node:internal/modules/esm/resolve:873
throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), null);
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'zod' imported from /app/dist/cli.mjs
at packageResolve (node:internal/modules/esm/resolve:873:9)
at moduleResolve (node:internal/modules/esm/resolve:946:18)
at defaultResolve (node:internal/modules/esm/resolve:1188:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:708:12)
at #cachedDefa# syntax=docker/dockerfile:1
# Builder stage: install Bun, install dependencies and build the CLI from source
FROM debian:bookworm-slim AS builder
ENV DEBIAN_FRONTEND=noninteractive
# Install essential tools
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
curl \
git \
tzdata \
unzip \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Install Bun (JavaScript/TypeScript runtime and package manager)
ENV BUN_INSTALL=/root/.bun
ENV PATH="${BUN_INSTALL}/bin:${PATH}"
RUN curl -fsSL https://bun.sh/install | bash
WORKDIR /app
COPY . .
# Initialize a git repository to satisfy lefthook/bun prepare steps during install
RUN git init
# Disable prepare scripts that might rely on git in the build stage
RUN bun pm disable-script prepare || true
# Install dependencies for the whole monorepo
RUN bun install --frozen-lockfile
# Build the CLI (output expected under apps/cli/dist)
WORKDIR /app/apps/cli
RUN bun run build
# Simple sanity check for build output
RUN [ -f dist/cli.mjs ] || (echo "Expected output dist/cli.mjs not found" && exit 1)
# Runtime stage: Node 20 as the execution environment
FROM node:20-slim AS runtime
ENV NODE_ENV=production
WORKDIR /app
# Copy built CLI artifacts from the builder stage
COPY --from=builder /app/apps/cli/dist /app/cli/dist
COPY --from=builder /app/apps/cli/package.json /app/cli/package.json
# Install runtime dependencies for the CLI
WORKDIR /app/cli
RUN npm install --production
# Create a non-root user for security
RUN useradd -m appuser
USER appuser
# Entrypoint: run the built CLI
CMD ["node", "/app/cli/dist/cli.mjs"]
- Failing command: [runtime 6/7] RUN npm install --production
- Dockerfile: line 55
- Exact messages:
- 0.374 npm warn config production Use `--omit=dev` instead.
- 0.906 npm error code EUNSUPPORTEDPROTOCOL
- 0.907 npm error Unsupported URL Type "workspace:": workspace:*
- 0.908 npm error A complete log of this run can be found in: /root/.npm/_logs/2026-03-22T13_07_47_138Z-debug-0.log
- Result: process "/bin/sh -c npm install --production" did not complete successfully: exit code: 1
- Missing packages or files: None explicitly listed as missing; log references a workspace URL type, not a concrete missing file/package.
- Root cause information:
- The error indicates an unsupported URL type "workspace:" (workspace:*), suggesting npm in the runtime image does not support workspaces.
- Likely mismatch: package.json uses workspaces syntax (workspace:*) and the runtime base image (node:20-slim) npm version lacks workspace support (npm v7+ required).
- Suggestions/next steps:
- Use a Node image with a compatible npm (v7+) or adjust package.json to avoid workspace:* for production install.
- Alternatively switch to a workspace-capable tool (Yarn) or run a workspace install in a separate step.
- Ensure dist/cli.mjs does not require devDependencies at runtime.
- If monorepo tooling is needed, ensure CI/build provides the Bun setup if using Bun.
- Consider updating Dockerfile/workflow to reflect: align npm version, or remove workspace references for production install.# syntax=docker/dockerfile:1
# Builder stage: install Bun, install dependencies and build the CLI from source
FROM debian:bookworm-slim AS builder
ENV DEBIAN_FRONTEND=noninteractive
# Install essential tools
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
curl \
git \
tzdata \
unzip \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Install Bun (JavaScript/TypeScript runtime and package manager)
ENV BUN_INSTALL=/root/.bun
ENV PATH="${BUN_INSTALL}/bin:${PATH}"
RUN curl -fsSL https://bun.sh/install | bash
WORKDIR /app
COPY . .
# Initialize a git repository to satisfy lefthook/bun prepare steps during install
RUN git init
# Disable prepare scripts that might rely on git in the build stage
RUN bun pm disable-script prepare || true
# Install dependencies for the whole monorepo
RUN bun install --frozen-lockfile
# Build the CLI (output expected under apps/cli/dist)
WORKDIR /app/apps/cli
RUN bun run build
# Simple sanity check for build output
RUN [ -f dist/cli.mjs ] || (echo "Expected output dist/cli.mjs not found" && exit 1)
# Runtime stage: Node 20 as the execution environment
FROM node:20-slim AS runtime
ENV NODE_ENV=production
WORKDIR /app
# Copy built CLI artifacts from the builder stage
COPY --from=builder /app/apps/cli/dist /app/cli/dist
COPY --from=builder /app/apps/cli/package.json /app/cli/package.json
Concerns: No CMD/ENTRYPOINT in final runtime image; the CLI must be invoked explicitly (e.g., via node /app/cli/dist/cli.mjs), Relies on dist/cli.mjs being a self-contained bundle; if it depends on external modules at runtime, the image may fail without node_modules copied
Smoke [PASS]: test -f /app/cli/dist/cli.mjs
Smoke [FAIL]: node /app/cli/dist/cli.mjs --version
Output: node:internal/modules/esm/resolve:873
throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), null);
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'zod' imported from /app/cli/dist/cli.mjs
at packageResolve (node:internal/modules/esm/resolve:873:9)
at moduleResolve (node:internal/modules/esm/resolve:946:18)
at defaultResolve (node:internal/modules/esm/resolve:1188:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:708:12)
at #cached# syntax=docker/dockerfile:1
# Builder stage: install Bun, install dependencies and build the CLI from source
FROM debian:bookworm-slim AS builder
ENV DEBIAN_FRONTEND=noninteractive
# Install essential tools
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
curl \
git \
tzdata \
unzip \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Install Bun (JavaScript/TypeScript runtime and package manager)
ENV BUN_INSTALL=/root/.bun
ENV PATH="${BUN_INSTALL}/bin:${PATH}"
RUN curl -fsSL https://bun.sh/install | bash
WORKDIR /app
COPY . .
# Initialize a git repository to satisfy lefthook/bun prepare steps during install
RUN git init
# Disable prepare scripts that might rely on git in the build stage
RUN bun pm disable-script prepare || true
# Install dependencies for the whole monorepo
RUN bun install --frozen-lockfile
# Build the CLI (output expected under apps/cli/dist)
WORKDIR /app/apps/cli
RUN bun run build
# Simple sanity check for build output
RUN [ -f dist/cli.mjs ] || (echo "Expected output dist/cli.mjs not found" && exit 1)
# Runtime stage: use a Node base image for minimal runtime; bun is copied from builder
FROM node:20-slim AS runtime
ENV NODE_ENV=production
WORKDIR /app
# Copy Bun installation from builder so runtime can execute with Bun
COPY --from=builder /root/.bun /root/.bun
ENV PATH=/root/.bun/bin:${PATH}
# Copy built CLI artifacts from the builder stage
COPY --from=builder /app/apps/cli/dist /app/dist
COPY --from=builder /app/apps/cli/package.json /app/cli/package.json
# Optional: copy bun cache if needed (already in /root/.bun)
# Create a non-root user for security
RUN useradd -m appuser
USER appuser
# Entrypoint: run the built CLI using Bun to ensure dependencies resolution
CMD ["bun", "/app/dist/cli.mjs"]
Concerns: Final runtime image may be larger than necessary due to copying the entire Bun installation (/root/.bun) into the runtime stage, which can bloat the image., Smoke tests assume the CLI supports --help or --version; if the CLI uses a different invocation pattern, the smoke test may fail., No explicit HEALTHCHECK in the runtime image; adding one could help confirm the process remains healthy after startup. Smoke [FAIL]: bun --version Output: sh: 1: bun: Permission denied Smoke [PASS]: test -f /app/dist/cli.mjs Smoke [PASS]: bun /app/dist/cli.mjs --help || true
# syntax=docker/dockerfile:1
# Builder stage: install Bun, install dependencies and build the CLI from source
FROM debian:bookworm-slim AS builder
ENV DEBIAN_FRONTEND=noninteractive
# Install essential tools
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
curl \
git \
tzdata \
unzip \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Install Bun (JavaScript/TypeScript runtime and package manager)
ENV BUN_INSTALL=/root/.bun
ENV PATH="${BUN_INSTALL}/bin:${PATH}"
RUN curl -fsSL https://bun.sh/install | bash
WORKDIR /app
COPY . .
# Initialize a git repository to satisfy lefthook/bun prepare steps during install
RUN git init
# Disable prepare scripts that might rely on git in the build stage
RUN bun pm disable-script prepare || true
# Install dependencies for the whole monorepo
RUN bun install --frozen-lockfile
# Build the CLI (output expected under apps/cli/dist)
WORKDIR /app/apps/cli
RUN bun run build
# Simple sanity check for build output
RUN [ -f dist/cli.mjs ] || (echo "Expected output dist/cli.mjs not found" && exit 1)
# Runtime stage: use a Node base image for minimal runtime; bun is copied from builder
FROM node:20-slim AS runtime
ENV NODE_ENV=production
WORKDIR /app
# Copy Bun installation from builder so runtime can execute with Bun
COPY --from=builder /root/.bun /root/.bun
ENV PATH=/root/.bun/bin:${PATH}
# Copy built CLI artifacts from the builder stage
COPY --from=builder /app/apps/cli/dist /app/dist
COPY --from=builder /app/apps/cli/package.json /app/cli/package.json
# Create a non-root user for security, and fix permissions on bun binary if needed
RUN groupadd -r appuser && useradd -m -r -g appuser appuser
USER appuser
# Ensure bun is executable for the appuser
RUN chmod +x /root/.bun/bin/bun || true
# Entrypoint: run the built CLI using Bun to ensure dependencies resolution
CMD ["/root/.bun/bin/bun", "/app/dist/cli.mjs"]
Concerns: Potential permission issues: The Bun runtime is installed under /root/.bun in the builder and copied to the runtime image. If /root/.bun or /root/.bun/bin/bun are not accessible by the non-root appuser (permissions or ownership), the CLI may fail to run. Consider adjusting permissions (chown/chmod) or relocating Bun to a path accessible to the non-root user (e.g., /usr/local or /home/appuser/.bun)., Dependency/runtime resolution risk: The runtime copies only dist and a package.json to /app, relying on Bun to resolve dependencies at runtime. If the dist file expects additional files or runtime resolution that isn’t included with dist alone, the CLI might fail. Ensure the built dist.mjs is self-contained or include any necessary runtime artifacts. Smoke [PASS]: test -f /app/dist/cli.mjs Smoke [FAIL]: /root/.bun/bin/bun -v Output: sh: 1: /root/.bun/bin/bun: Permission denied Smoke [FAIL]: /root/.bun/bin/bun /app/dist/cli.mjs --version Output: sh: 1: /root/.bun/bin/bun: Permission denied
# syntax=docker/dockerfile:1
# 1) Builder stage: install Bun and build the CLI from source
FROM debian:bookworm-slim AS builder
ENV DEBIAN_FRONTEND=noninteractive
_RUNNER_APT="apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
curl \
git \
tzdata \
unzip \
build-essential \
&& rm -rf /var/lib/apt/lists/*"
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
curl \
git \
tzdata \
unzip \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Install Bun (JavaScript/TypeScript runtime and package manager)
ENV BUN_INSTALL=/root/.bun
ENV PATH="${BUN_INSTALL}/bin:${PATH}"
RUN curl -fsSL https://bun.sh/install | bash
WORKDIR /app
COPY . .
# Initialize a git repository to satisfy lefthook/bun prepare steps during install
RUN git init
# Disable prepare scripts that might rely on git in the build stage
RUN bun pm disable-script prepare || true
# Install dependencies for the whole monorepo
RUN bun install --frozen-lockfile
# Build the CLI (output expected under apps/cli/dist)
WORKDIR /app/apps/cli
RUN bun run build
# Simple sanity check for build output
RUN [ -f dist/cli.mjs ] || (echo "Expected output dist/cli.mjs not found" && exit 1)
# Runtime stage: use a Node base image for minimal runtime; Bun will be used from /usr/local/bun
FROM node:20-slim AS runtime
ENV NODE_ENV=production
WORKDIR /app
# Bring Bun into runtime (placed under /usr/local/bun for non-root access)
COPY --from=builder /root/.bun /usr/local/bun
RUN adduser --system --group appuser
RUN chown -R appuser:appuser /usr/local/bun
USER appuser
ENV PATH=/usr/local/bun/bin:$PATH
# Copy pre-built artifacts from builder
COPY --from=builder /app/apps/cli/dist /app/dist
COPY --from=builder /app/node_modules /app/node_modules
COPY --from=builder /app/apps/cli/node_modules /app/apps/cli/node_modules
# Optional: copy bunlock if present
COPY --from=builder /app/bun.lock /app/bun.lock 2>/dev/null || true
# Entrypoint: run the built CLI via Bun
CMD ["bun", "/app/dist/cli.mjs"]
Concerns: There is a stray line '_RUNNER_APT="apt-get update && \" which is not a valid Dockerfile instruction and will cause the build to fail., There is an unused environment-like variable line that seems to be a leftover (the _RUNNER_APT block) and duplicates of apt-get install., Overall, the Dockerfile has syntax/structural issues that prevent a reliable build.
# syntax=docker/dockerfile:1
# Builder stage: install Bun, install dependencies and build the CLI from source
FROM debian:bookworm-slim AS builder
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
curl \
git \
tzdata \
unzip \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Install Bun (JavaScript/TypeScript runtime and package manager)
ENV BUN_INSTALL=/root/.bun
ENV PATH="${BUN_INSTALL}/bin:${PATH}"
RUN curl -fsSL https://bun.sh/install | bash
WORKDIR /app
COPY . .
# Initialize a git repository to satisfy lefthook/bun prepare steps during install
RUN git init
# Disable prepare scripts that might rely on git in the build stage
RUN bun pm disable-script prepare || true
# Install dependencies for the whole monorepo
RUN bun install --frozen-lockfile
# Build the CLI (output expected under apps/cli/dist)
WORKDIR /app/apps/cli
RUN bun run build
# Simple sanity check for build output
RUN [ -f dist/cli.mjs ] || (echo "Expected output dist/cli.mjs not found" && exit 1)
# Runtime stage: Node.js runtime environment for final image
FROM node:20-slim AS runtime
ENV NODE_ENV=production
WORKDIR /app
# Copy built CLI artifacts from the builder stage
COPY --from=builder /app/apps/cli/dist /app/dist
COPY --from=builder /app/apps/cli/package.json /app/package.json
# Copy potential runtime dependencies if present (best-effort)
COPY --from=builder /app/apps/cli/node_modules /app/node_modules 2>/dev/null || true
COPY --from=builder /app/node_modules /app/node_modules 2>/dev/null || true
# Create a non-root user for safety
RUN useradd -m appuser
USER appuser
# Entrypoint: run the built CLI with Node
CMD ["node", "/app/dist/cli.mjs"]
Concerns: The final runtime COPY commands include shell redirection and a retry with '|| true' (e.g., 'COPY --from=builder /app/apps/cli/node_modules /app/node_modules 2>/dev/null || true'), which is invalid Dockerfile syntax and will cause the build to fail., There are two suspicious COPY lines in the runtime stage that attempt to silence errors with shell syntax, which Docker's COPY instruction does not support.
# syntax=docker/dockerfile:1
# Builder stage: install Bun, install dependencies and build the CLI from source
FROM debian:bookworm-slim AS builder
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
curl \
git \
tzdata \
unzip \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Install Bun (JavaScript/TypeScript runtime and package manager)
ENV BUN_INSTALL=/root/.bun
ENV PATH="${BUN_INSTALL}/bin:${PATH}"
RUN curl -fsSL https://bun.sh/install | bash
WORKDIR /app
COPY . .
# Initialize a git repository to satisfy lefthook/bun prepare steps during install
RUN git init
# Disable prepare scripts that might rely on git in the build stage
RUN bun pm disable-script prepare || true
# Install dependencies for the whole monorepo
RUN bun install --frozen-lockfile
# Build the CLI (output expected under apps/cli/dist)
WORKDIR /app/apps/cli
RUN bun run build
# Simple sanity check for build output
RUN [ -f dist/cli.mjs ] || (echo "Expected output dist/cli.mjs not found" && exit 1)
# Runtime stage: Node.js runtime environment for final image
FROM node:20-slim AS runtime
ENV NODE_ENV=production
WORKDIR /app
# Copy built CLI artifacts from the builder stage
COPY --from=builder /app/apps/cli/dist /app/dist
COPY --from=builder /app/apps/cli/package.json /app/package.json
# Create a non-root user for safety
RUN useradd -m appuser
USER appuser
# Entrypoint: run the built CLI with Node
CMD ["node", "/app/dist/cli.mjs"]
Concerns: Assumes dist/cli.mjs is a self-contained bundle suitable for Node; if build output still requires runtime bundler or additional node_modules, the final image may fail to run the CLI., Runtime image only copies dist and package.json; if the CLI relies on extra assets, configuration files, or environment setup not included in dist, it could fail at runtime.
Smoke [PASS]: test -f /app/dist/cli.mjs
Smoke [PASS]: node --version
Smoke [FAIL]: node /app/dist/cli.mjs --version
Output: node:internal/modules/esm/resolve:873
throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), null);
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'zod' imported from /app/dist/cli.mjs
at packageResolve (node:internal/modules/esm/resolve:873:9)
at moduleResolve (node:internal/modules/esm/resolve:946:18)
at defaultResolve (node:internal/modules/esm/resolve:1188:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:708:12)
at #cachedDefa# syntax=docker/dockerfile:1
# Builder stage: install Bun and build the CLI from source
FROM debian:bookworm-slim AS builder
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
curl \
git \
tzdata \
unzip \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Install Bun (JavaScript/TypeScript runtime and package manager)
ENV BUN_INSTALL=/root/.bun
ENV PATH="${BUN_INSTALL}/bin:${PATH}"
RUN curl -fsSL https://bun.sh/install | bash
WORKDIR /app
COPY . .
# Initialize a git repository to satisfy lefthook/bun prepare steps during install
RUN git init
# Disable prepare scripts that might rely on git in the build stage
RUN bun pm disable-script prepare || true
# Install dependencies for the whole monorepo
RUN bun install --frozen-lockfile
# Build the CLI (output expected under apps/cli/dist)
WORKDIR /app/apps/cli
RUN bun run build
# Simple sanity check for build output
RUN [ -f dist/cli.mjs ] || (echo "Expected output dist/cli.mjs not found" && exit 1)
# Runtime stage: Node.js runtime environment for final image
FROM node:20-slim AS runtime
ENV NODE_ENV=production
WORKDIR /app
# Copy built CLI artifacts from the builder stage
COPY --from=builder /app/apps/cli/dist /app/dist
COPY --from=builder /app/apps/cli/node_modules /app/node_modules 2>/dev/null || true
COPY --from=builder /app/node_modules /app/node_modules 2>/dev/null || true
# Create a non-root user for safety
RUN useradd -m appuser
USER appuser
# Entrypoint: run the built CLI with Node
CMD ["node", "/app/dist/cli.mjs"]
- ERROR: failed to build: failed to solve: failed to compute cache key: failed to calculate checksum of ref dm0crafjnw8l43ifl6uhde0ck::qh8p9ymzvs1b5kwc5upbkrh28: "/2>/dev/null": not found - ERROR: failed to calculate checksum of ref dm0crafjnw8l43ifl6uhde0ck::qh8p9ymzvs1b5kwc5upbkrh28: "/||": not found - Failing command/step: - [runtime 4/6] COPY --from=builder /app/apps/cli/node_modules /app/node_modules 2>/dev/null || true - [runtime 5/6] COPY --from=builder /app/node_modules /app/node_modules 2>/dev/null || true - Context of the failure: - The COPY commands in the runtime stage include shell redirection (2>/dev/null) and a conditional (|| true). Dockerfile COPY commands are not shell commands; including redirection and shell logic causes the resolver to misinterpret the paths, leading to checksum/cache key calculation failures. - Missing packages or files mentioned: - No specific missing packages or files; the issue is invalid Dockerfile syntax (shell redirection) in COPY lines, not missing dependencies. - Version mismatch information: - bun install reported: v1.3.11 - bun command attempted: bun pm disable-script prepare || true → error "disable-script" unknown command, but not the root cause. No explicit version mismatch errors shown. - Notes: - Build reached builder/runtime stages up to the problematic COPY steps; root cause is the inclusion of shell syntax in COPY instructions. - Actionable next steps: - Remove 2>/dev/null and || true from the COPY lines (use plain COPY syntax). - If needed, clean up Dockerfile to ensure COPY commands refer to actual paths. - Consider adding a .dockerignore to reduce image size (exclude tests/docs/examples). - Verify dist/cli.mjs compatibility with Node 20. - Ensure runtime dependencies are present in the final image.
# syntax=docker/dockerfile:1
# Stage 1: Builder - install Bun, install dependencies and build the CLI from source
FROM debian:bookworm-slim AS builder
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
curl \
git \
tzdata \
unzip \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Install Bun (JavaScript/TypeScript runtime and package manager)
ENV BUN_INSTALL=/root/.bun
ENV PATH="${BUN_INSTALL}/bin:${PATH}"
RUN curl -fsSL https://bun.sh/install | bash
WORKDIR /app
COPY . .
# Initialize a git repository to satisfy lefthook/bun prepare steps during install
RUN git init
# Disable prepare scripts that might rely on git in the build stage
RUN bun pm disable-script prepare || true
# Install dependencies for the whole monorepo
RUN bun install --frozen-lockfile
# Build the CLI (output expected under apps/cli/dist)
WORKDIR /app/apps/cli
RUN bun run build
# Simple sanity check for build output
RUN [ -f dist/cli.mjs ] || (echo "Expected output dist/cli.mjs not found" && exit 1)
# Stage 2: Runtime - use a minimal image and run the built CLI with Bun
FROM debian:bookworm-slim AS runtime
ENV NODE_ENV=production
# Create a non-root user for safety
RUN groupadd -r appuser && useradd -m -r -g appuser appuser
WORKDIR /app
# Copy Bun installation from builder and set up permissions
COPY --from=builder /root/.bun /home/appuser/.bun
RUN chown -R appuser:appuser /home/appuser
# Copy built CLI from builder
COPY --from=builder /app/apps/cli/dist /home/appuser/app/dist
# Ensure bun is in PATH for the app user
ENV PATH=/home/appuser/.bun/bin:$PATH
USER appuser
# Entrypoint: run the built CLI with Bun
CMD ["bun", "/home/appuser/app/dist/cli.mjs"]
Build timed out after 600s
FROM ghcr.io/oven/bun:latest AS builder WORKDIR /work COPY . . RUN bun install RUN cd apps/cli && bun run build FROM ghcr.io/oven/bun:latest AS runtime WORKDIR /app COPY --from=builder /work/apps/cli/dist /app/dist RUN chmod -R 755 /app/dist ENTRYPOINT ["bun", "/app/dist/cli.mjs"]
FROM node:20-slim AS builder
WORKDIR /app
# Install dependencies for Bun and building
RUN apt-get update && apt-get install -y curl ca-certificates && rm -rf /var/lib/apt/lists/*
# Install Bun
RUN bash -lc "curl -fsSL https://bun.sh/install | bash"
ENV PATH="/root/.bun/bin:${PATH}"
# Copy repository and install dependencies
COPY . .
RUN bun install
# Build the CLI from source
RUN cd apps/cli && bun run build
# Runtime image
FROM node:20-slim AS runtime
WORKDIR /app
# Copy built artifacts and dependencies from builder
COPY --from=builder /app/apps/cli/dist /app/dist
COPY --from=builder /app/node_modules /app/node_modules
# Run the CLI when container starts
ENTRYPOINT ["node", "/app/dist/cli.mjs"]
node_modules/ bun.lock .dist/ .git .github .DS_Store *.log *.tmp
- Failing step: [builder 4/7] RUN bash -lc "curl -fsSL https://bun.sh/install | bash" - Exact error message and exit code: - Error: "error: unzip is required to install bun" - Exit code: 1 - What’s missing or causing the failure: unzip package is not installed in the image. Bun’s installer requires unzip. - Version mismatch info: None indicated. - Quick fix: Install unzip before running Bun install, e.g. add to the Dockerfile prior to step 4: - apt-get update && apt-get install -y unzip - (Retain curl and ca-certificates as already present)
FROM node:20-slim AS builder
WORKDIR /app
# Install dependencies for Bun and building
RUN apt-get update && apt-get install -y curl ca-certificates unzip && rm -rf /var/lib/apt/lists/*
# Install Bun
RUN bash -lc "curl -fsSL https://bun.sh/install | bash"
ENV PATH="/root/.bun/bin:${PATH}"
# Copy repository and install dependencies
COPY . .
RUN bun install
# Build the CLI from source
RUN cd apps/cli && bun run build
# Runtime image
FROM node:20-slim AS runtime
WORKDIR /app
# Copy built artifacts and dependencies from builder
COPY --from=builder /app/apps/cli/dist /app/dist
COPY --from=builder /app/node_modules /app/node_modules
# Run the CLI when container starts
ENTRYPOINT ["node", "/app/dist/cli.mjs"]
Summary (under 1500 chars):
- Exact error message and exit code
- Error: exec: "git": executable file not found in $PATH
- bun install did not complete successfully: exit code: 1
- Failing command/step
- [builder 6/7] RUN bun install (Dockerfile:12)
- The failure occurs while bun install runs lefthook install, which attempts to invoke git.
- Missing packages or files mentioned
- git is not installed in the image or not available on PATH ("executable file not found in $PATH").
- Version information
- Base image: node:20-slim
- bun install: v1.3.11
- bun installed to ~/.bun/bin/bun
- The error occurs during bun install (version 1.3.11) after dependencies were resolved and a lockfile saved.
Notes
- Root cause appears to be missing Git in the container. Installing git (e.g., via apt-get install -y git) before running bun install should address the issue.FROM node:20-slim AS builder
WORKDIR /app
# Install dependencies for Bun and building
RUN apt-get update && apt-get install -y curl ca-certificates unzip git && rm -rf /var/lib/apt/lists/*
# Install Bun
RUN bash -lc "curl -fsSL https://bun.sh/install | bash"
ENV PATH="/root/.bun/bin:${PATH}"
# Copy repository and install dependencies
COPY . .
RUN bun install
# Build the CLI from source
RUN cd apps/cli && bun run build
# Runtime image
FROM node:20-slim AS runtime
WORKDIR /app
# Copy built artifacts and dependencies from builder
COPY --from=builder /app/apps/cli/dist /app/dist
COPY --from=builder /app/node_modules /app/node_modules
# Run the CLI when container starts
ENTRYPOINT ["node", "/app/dist/cli.mjs"]
Summary of Docker build error - Failing command/step - RUN bun install (builder stage 6/7; Dockerfile: line 12) - Exact error messages and exit codes to preserve - fatal: not a git repository (or any of the parent directories): .git - exit status 128 - error: prepare script from "better-t-stack" exited with 1 - The overall bun install step exits with code 1 - Missing packages/files mentioned - The error stems from a Git command failing because the working directory is not a Git repository (no .git directory in the build context). This causes lefthook (a Git hook runner invoked during bun install) to fail with exit status 128, leading to the “prepare script from 'better-t-stack' exited with 1.” - Version mismatch/info - bun install version: v1.3.11 - Base image uses node:20-slim - The failure is environmental (missing .git repository) rather than a library/version mismatch. The Lefthook prepare script expects a Git repo; since .git isn’t present in the container, the script fails.
FROM node:20-slim AS builder WORKDIR /workspace # Install dependencies for building RUN apt-get update && apt-get install -y curl ca-certificates unzip && rm -rf /var/lib/apt/lists/* # Copy lockfile and package manifests first to leverage caching COPY package.json bunfig.toml bun.lock ./ COPY apps/cli/package.json apps/cli/package.json # Install workspace dependencies using npm (assumes root package.json defines workspaces) RUN npm install # Copy the rest of the project and build the CLI COPY . . RUN npm run -w apps/cli build # Runtime image FROM node:20-slim AS runtime WORKDIR /app # Copy built artifacts and dependencies from builder COPY --from=builder /workspace/apps/cli/dist /app/dist COPY --from=builder /workspace/node_modules /app/node_modules # Expose CLI as entrypoint ENTRYPOINT ["node", "/app/dist/cli.mjs"]
Summary: - Exact error message and exit code - Error: ERROR: failed to build: failed to solve: failed to compute cache key: failed to calculate checksum of ref dm0crafjnw8l43ifl6uhde0ck::exe034hdgujdpf5vkuxuse7wi: "/bun.lock": not found - Exit code: non-zero (build failure) - Failing command/step - [builder 4/8] COPY package.json bunfig.toml bun.lock ./ - Missing packages or files mentioned - bun.lock not found - Note in log: CopyIgnoredFile: Attempting to Copy file "bun.lock" that is excluded by .dockerignore (line 8) - .dockerignore appears to exclude bun.lock, which prevents it from being included in the build context - Version mismatch info - Base image used: node:20-slim@sha256:17281e8d1dc4d671976c6b89a12f47a44c2f390b63a989e2e327631041f544fd - No explicit version mismatch reported; the failure is due to bun.lock being unavailable/included contrary to .dockerignore - Quick notes for remediation - Ensure bun.lock is present in the build context and not excluded by .dockerignore, or remove bun.lock from the COPY in the Dockerfile if not needed - Alternatively adjust the Dockerfile to only copy existing/required files, or update the .dockerignore to allow bun.lock when appropriate
FROM node:20-slim AS builder WORKDIR /workspace # Install dependencies for building RUN apt-get update && apt-get install -y curl ca-certificates unzip git && rm -rf /var/lib/apt/lists/* # Copy bun lock and manifest if present COPY bun.lock bunfig.toml package.json ./ # Install with bun if bun.lock exists, otherwise npm RUN if [ -f bun.lock ]; then \ echo "Using bun"; \ npm set-script build "bun run build"; \ npm install; \ bun install; \ else \ echo "Using npm"; \ npm install; \ fi # Copy the rest of the project and build the CLI COPY . . RUN npm run -w apps/cli build || bun run -w apps/cli build # Runtime image FROM node:20-slim AS runtime WORKDIR /app # Copy built artifacts and dependencies from builder COPY --from=builder /workspace/apps/cli/dist /app/dist COPY --from=builder /workspace/node_modules /app/node_modules # Expose CLI as entrypoint ENTRYPOINT ["node", "/app/dist/cli.mjs"]
Summary (under 1500 chars): - Exact error message and exit code - ERROR: failed to build: failed to solve: failed to compute cache key: failed to calculate checksum of ref dm0crafjnw8l43ifl6uhde0ck::zj78p5k9i5p7y26na481vpc2h: "/bun.lock": not found - Exit code: not shown in the log - Failing command/step - [builder 4/7] COPY bun.lock bunfig.toml package.json ./: - Missing packages/files mentioned - bun.lock not found in build context - Warning: CopyIgnoredFile: Attempting to Copy file "bun.lock" that is excluded by .dockerignore (line 8) - Version mismatch/info - Base image used: node:20-slim@sha256:17281e8d1dc4d671976c6b89a12f47a44c2f390b63a989e2e327631041f544fd - Additional context - The COPY step tries to copy bun.lock along with bunfig.toml and package.json, but bun.lock is excluded by .dockerignore and/or missing from context, causing the checksum calculation to fail.
FROM node:20-slim AS builder WORKDIR /workspace # Install essential build tools RUN apt-get update && apt-get install -y curl ca-certificates unzip git && rm -rf /var/lib/apt/lists/* # Copy root package manifests first to leverage caching if possible COPY package.json package.json COPY apps/cli/package.json apps/cli/package.json # Install workspace dependencies using npm (ignore scripts to skip prepare hooks) RUN npm install --ignore-scripts # Copy the rest of the repository and build the CLI COPY . . RUN npm run -w apps/cli build # Runtime image FROM node:20-slim AS runtime WORKDIR /app # Copy built artifacts and dependencies from builder COPY --from=builder /workspace/apps/cli/dist /app/dist COPY --from=builder /workspace/node_modules /app/node_modules # Run the CLI when container starts ENTRYPOINT ["node", "/app/dist/cli.mjs"]
- Exact error message and exit code - npm error code EUNSUPPORTEDPROTOCOL - npm error Unsupported URL Type "workspace:": workspace:* - Exit code: 1 - Failing command/step - [builder 6/8] RUN npm install --ignore-scripts - Missing packages or files mentioned - No specific missing file/package listed. The failure is due to an invalid workspace protocol in dependencies (workspace: *). - Version mismatch info - npm notice: New major version available: 10.8.2 -> 11.12.0 - This indicates a potential npm version mismatch vs. workspace usage referenced in the error.
FROM node:20-slim AS builder
WORKDIR /workspace
# Install essential build tools
RUN apt-get update && apt-get install -y curl ca-certificates unzip git && rm -rf /var/lib/apt/lists/*
# Copy root package manifests first to leverage caching if possible
COPY package.json bunfig.toml bun.lock ./
# Install bun if lockfile exists, otherwise npm
RUN if [ -f bun.lock ]; then \
echo "Using bun"; \
curl -fsSL https://bun.sh/install | bash; \
export PATH="/root/.bun/bin:${PATH}"; \
bun install; \
else \
echo "Using npm"; \
npm install; \
fi
# Copy the rest of the repository and build the CLI
COPY . .
RUN if [ -f bun.lock ]; then bun run -w apps/cli build; else npm run -w apps/cli build; fi
# Runtime image
FROM node:20-slim AS runtime
WORKDIR /app
# Copy built artifacts and dependencies from builder
COPY --from=builder /workspace/apps/cli/dist /app/dist
COPY --from=builder /workspace/node_modules /app/node_modules
# Run the CLI when container starts
ENTRYPOINT ["node", "/app/dist/cli.mjs"]
Concerns: COPY package.json bunfig.toml bun.lock ./ will fail if bun.lock does not exist in the repository., If bun.lock exists, the build relies on Bun, but the PATH is only updated in the same RUN where Bun is installed; PATH changes do not persist to subsequent RUN steps, so bun may not be found during the next RUN that calls bun., Because PATH is not persisted across RUN steps, the subsequent build step using bun (bun run -w apps/cli build) will fail unless PATH is globally updated (e.g., via ENV) or Bun is invoked with an absolute path.
FROM node:20-slim AS builder WORKDIR /workspace # Install essential build tools RUN apt-get update && apt-get install -y curl ca-certificates unzip git && rm -rf /var/lib/apt/lists/* # Install Bun if bun.lock exists, otherwise use npm; we'll check for bun.lock at runtime in a shell script COPY entrypoint-build.sh /entrypoint-build.sh RUN chmod +x /entrypoint-build.sh # Copy root package manifests first to leverage caching if possible COPY package.json bunfig.toml bun.lock ./ RUN /entrypoint-build.sh # Copy the rest of the repository and build the CLI COPY . . # Runtime image FROM node:20-slim AS runtime WORKDIR /app # Copy built artifacts and dependencies from builder COPY --from=builder /workspace/apps/cli/dist /app/dist COPY --from=builder /workspace/node_modules /app/node_modules # Run the CLI when container starts ENTRYPOINT ["node", "/app/dist/cli.mjs"]
#!/bin/sh
set -e
if [ -f bun.lock ]; then
echo "Using Bun"
curl -fsSL https://bun.sh/install | bash
export PATH="/root/.bun/bin:${PATH}"
bun install
bun run -w apps/cli build
else
echo "Using npm"
npm install
npm run -w apps/cli build
fi
- Exact error message and exit code
- Error: "ERROR: failed to calculate checksum of ref dm0crafjnw8l43ifl6uhde0ck::gyd5klj5zvwgypoil9aoxbc4c: \"/bun.lock\": not found"
- Exit code: not shown in the log
- Failing command/step
- [builder 6/8] COPY package.json bunfig.toml bun.lock ./
- Missing packages or files mentioned
- bun.lock is not found ("/bun.lock": not found)
- There is a CopyIgnoredFile warning: Attempting to Copy file "bun.lock" that is excluded by .dockerignore (line 12)
- Dockerfile line 12 shows: COPY package.json bunfig.toml bun.lock ./
- Version mismatch info
- Base image used: docker.io/library/node:20-slim with digest sha256:17281e8d1dc4d671976c6b89a12f47a44c2f390b63a989e2e327631041f544fdFROM node:20-slim AS builder WORKDIR /workspace # Install essential build tools RUN apt-get update && apt-get install -y curl ca-certificates unzip git && rm -rf /var/lib/apt/lists/* # Copy manifests first to leverage Docker cache COPY package.json bunfig.toml ./ # Install workspace dependencies using npm (assumes root package.json defines workspaces) RUN npm install # Copy the rest of the repository and build the CLI COPY . . RUN npm run -w apps/cli build # Runtime image FROM node:20-slim AS runtime WORKDIR /app # Copy built artifacts and dependencies from builder COPY --from=builder /workspace/apps/cli/dist /app/dist COPY --from=builder /workspace/node_modules /app/node_modules # Run the CLI when container starts ENTRYPOINT ["node", "/app/dist/cli.mjs"]
Summary of Docker build error
- Failing command/step:
- builder 5/7: RUN npm install
- Inside this, npm runs lefthook install and fails
- Exact error messages and exit codes to preserve:
- npm warn EBADENGINE Unsupported engine {
package: 'better-t-stack@0.0.0',
required: { node: '24.x' },
current: { node: 'v20.20.1', npm: '10.8.2' }
}
- fatal: not a git repository (or any of the parent directories): .git
- exit status 128
- npm error code 1
- process "/bin/sh -c lefthook install" did not complete successfully: exit code: 1
- A complete log of this run can be found in: /root/.npm/_logs/2026-03-22T13_57_56_665Z-debug-0.log
- Missing packages or files mentioned:
- The Lefthook step failed due to “not a git repository,” indicating the workspace is not a git repository (no .git directory in /workspace).
- Version mismatch info:
- Base image uses node:20-slim; package expects node 24.x (EBADENGINE warning)
- Current npm version is 10.8.2; newer npm is available (11.12.0)
Notes:
- The failure is caused by Lefthook trying to run git-rev-parse in a non-git workspace during npm install, not by a missing npm package per se.
- To resolve: ensure the build runs in a git-tracked workspace (with .git), or adjust Lefthook/config to run in a non-git context, or upgrade Node to 24.x (or align engine requirements).FROM node:24-slim AS builder WORKDIR /workspace # Install essential build tools RUN apt-get update && apt-get install -y curl ca-certificates unzip git && rm -rf /var/lib/apt/lists/* # Copy manifests and bun lock if present COPY package.json bunfig.toml bun.lock ./ # Install dependencies (assumes workspaces using npm) RUN npm install # Copy the rest of the repository and build the CLI COPY . . RUN npm run -w apps/cli build # Runtime image FROM node:24-slim AS runtime WORKDIR /app # Copy built artifacts and dependencies from builder COPY --from=builder /workspace/apps/cli/dist /app/dist COPY --from=builder /workspace/node_modules /app/node_modules # Run the CLI when container starts ENTRYPOINT ["node", "/app/dist/cli.mjs"]
Summary (under 1500 chars): - VerifyBuild status: build_failed - Base image: docker.io/library/node:24-slim (SHA: sha256:d8e448a56fc6…d8e33d8) - Dockerfile actions and context: - [builder 4/7] COPY package.json bunfig.toml bun.lock ./ - Error: failed to calculate checksum of ref dm0crafjnw8l43ifl6uhde0ck::unztyfwewuilrdaih2pcpg537: "/bun.lock": not found - Warning: CopyIgnoredFile: Attempting to Copy file "bun.lock" that is excluded by .dockerignore (line 8) - Build context size: 5.22MB - Context transfer steps completed; build canceled after error - Reproduced steps detail: - #4 [builder 1/7] FROM docker.io/library/node:24-slim@sha256:... - #7 [builder 4/7] RUN … (present) - #8 COPY package.json bunfig.toml bun.lock ./ failed with above error - File/pack names involved: package.json, bunfig.toml, bun.lock - Prior concerns raised (early in output): - COPY may fail if bunfig.toml or bun.lock are not present; if bun tooling isn’t used, copy only package.json or ensure files exist - No .dockerignore shown: host node_modules could be copied into builder context - Dev dependencies may be installed in builder and copied to runtime; could bloat image; suggestion to use npm ci --omit=dev (or npm install --omit=dev) - Actionable fixes to apply: - Ensure bun.lock exists in the build context, or remove bun.lock from COPY if Bun isn’t used - Update .dockerignore to stop excluding bun.lock or explicitly include it if needed - If Bun tooling isn’t used, copy only package.json (and bunfig.toml/bun.lock only if present and required) - In builder step, install production dependencies only (e.g., npm ci --omit=dev) and only copy production deps to runtime - Add a .dockerignore to exclude node_modules and other build artifacts to avoid bloated layers Notes: - The immediate failure is due to attempting to copy bun.lock which is not present or is ignored by .dockerignore.
node_modules/ bun.lock
Summary (under 1500 chars): - Exact error message and exit code: - Error: ERROR: failed to build: failed to solve: failed to compute cache key: failed to calculate checksum of ref dm0crafjnw8l43ifl6uhde0ck::7j5jogsr3zqdbfj4oe2d01srg: "/bun.lock": not found - Exit code: not explicitly shown in log (build failed with non-zero status) - Failing command/step: - [builder 4/7] COPY package.json bunfig.toml bun.lock ./ - Missing packages or files mentioned: - bun.lock not found in build context - Also notes a warning: CopyIgnoredFile - bun.lock is excluded by .dockerignore (line 8) - Version mismatch information: - Base image: node:24-slim with sha256:d8e448a56fc63242f70026718378bd4b00f8c82e78d20eefb199224a4d8e33d8 - No explicit version mismatch reported beyond this.