# Reusable Dockerfile for Deno e2e tests # Usage: docker build -f Dockerfile.deno --build-arg DENO_VERSION=2.6.7 --build-arg NODE_MAJOR=22 -t test-name . # # Uses official denoland/deno images. For multi-version testing, run the build/run # multiple times with different DENO_VERSION values from the shell script. # # Deno is the test matrix axis (base image); Node comes from nodesource (needed by # pnpm and the build). bun and pnpm are installed from mise.toml/mise.lock, with # node/deno disabled in mise so it does not shadow the base/nodesource binaries. ARG DENO_VERSION FROM denoland/deno:${DENO_VERSION} ARG NODE_MAJOR ENV MISE_DATA_DIR="/mise" ENV MISE_DISABLE_TOOLS="node,deno,python,uv" ENV PATH="/mise/shims:$PATH" # Switch to root for installation USER root WORKDIR /app # Install system dependencies RUN apt-get update && \ apt-get install -y --no-install-recommends ca-certificates curl unzip && \ rm -rf /var/lib/apt/lists/* # Install Node.js (needed for pnpm's npm backend and building packages) RUN curl -fsSL "https://deb.nodesource.com/setup_${NODE_MAJOR}.x" | bash - && \ apt-get install -y nodejs && \ rm -rf /var/lib/apt/lists/* # Install bun + pnpm via mise (versions pinned in mise.toml/mise.lock). # mise is installed to /usr/local/bin and the tool binaries are symlinked there too so # they stay on PATH for the non-root runtime user (login shells reset PATH). RUN curl -fsSL https://mise.run | MISE_INSTALL_PATH=/usr/local/bin/mise sh COPY mise.toml mise.lock ./ RUN mise trust /app/mise.toml && \ mise install && \ ln -sf "$(mise which bun)" /usr/local/bin/bun && \ ln -sf "$(mise which pnpm)" /usr/local/bin/pnpm && \ pnpm --version && \ bun --version # Copy lockfile first for optimal layer caching COPY pnpm-lock.yaml ./ # Copy workspace configuration files COPY package.json \ pnpm-workspace.yaml \ .pnpmfile.cjs \ tsconfig.base.json \ tsdown.config.base.ts \ toolchain-versions.json \ ./ # Copy pre-install scripts (rarely change) COPY ts/scripts/pre-install.sh ./ts/scripts/pre-install.sh COPY ts/scripts/pre-install/ ./ts/scripts/pre-install/ # Copy all ts/packages (pre-built) COPY ts/packages/ ./ts/packages/ # Install dependencies using pnpm # Note: We intentionally don't use --mount=type=cache for the pnpm store here # because it causes native binding issues (e.g., rolldown-binding) across builds RUN BYPASS_TOOLCHAIN_CHECK=1 pnpm install --frozen-lockfile # Copy e2e tests last (changes frequently) COPY ts/e2e-tests/ ./ts/e2e-tests/ # Create deno user and group (to match the official image's user) RUN groupadd -g 1000 deno 2>/dev/null || true && \ useradd -u 1000 -g deno -m deno 2>/dev/null || true && \ chown -R deno:deno /app # Pre-create Deno cache directory ENV DENO_DIR="/home/deno/.cache/deno" RUN mkdir -p $DENO_DIR && chown -R deno:deno /home/deno USER deno CMD ["sh"]