# syntax=docker/dockerfile:1
FROM golang:trixie AS builder
ENV CGO_ENABLED=0
RUN apt-get update -y && \
apt-get install -y --no-install-recommends ca-certificates curl tar gcc libc6-dev make && \
rm -rf /var/lib/apt/lists/*
WORKDIR /src
COPY . .
RUN make esbuild
FROM debian:bookworm-slim
RUN apt-get update -y && \
apt-get install -y --no-install-recommends ca-certificates && \
rm -rf /var/lib/apt/lists/*
COPY --from=builder /src/esbuild /usr/local/bin/esbuild
RUN chmod +x /usr/local/bin/esbuild
ENTRYPOINT ["esbuild"]
# Ignore VCS and local artifacts .git .gitignore **/.DS_Store Thumbs.db # Node/frontend artifacts (not needed for this Go build) node_modules npm-debug.log yarn.lock package-lock.json # Esbuild caches and build outputs .esbuild .esbuild-cache dist build tmp # Go module cache (will be downloaded in build stage) go/pkg/mod
- Failing step (command/step): [builder 5/5] RUN make esbuild - Exact error message and exit code: - make: node: No such file or directory - Makefile:317: version-go - Error 127 - node scripts/esbuild.js --update-version-go - Docker-level failure: failed to solve: process "/bin/sh -c make esbuild" did not complete successfully: exit code: 2 - Missing packages or files mentioned: - Node binary is missing (no node installed in the image), causing the esbuild script to fail. - Version mismatch info: - No explicit version mismatch reported. The failure is due to a missing Node binary, not a version incompatibility. The build uses golang:trixie and Debian bookworm-slim images, but the error arises from a missing runtime dependency (node) required by the esbuild step.
# syntax=docker/dockerfile:1
FROM golang:trixie AS builder
ENV CGO_ENABLED=0
RUN apt-get update -y && \
apt-get install -y --no-install-recommends ca-certificates curl tar gcc libc6-dev make nodejs && \
rm -rf /var/lib/apt/lists/*
WORKDIR /src
COPY . .
RUN make esbuild
FROM debian:bookworm-slim
RUN apt-get update -y && \
apt-get install -y --no-install-recommends ca-certificates && \
rm -rf /var/lib/apt/lists/*
COPY --from=builder /src/esbuild /usr/local/bin/esbuild
RUN chmod +x /usr/local/bin/esbuild
ENTRYPOINT ["esbuild"]
Concerns: Runs as root by default; consider adding a non-root user for security., Builder stage installs nodejs which isn't required for the final image; could be trimmed.
Smoke [FAIL]: printf "console.log('smoke_ok');" > /tmp/input.js; esbuild /tmp/input.js --bundle --outfile=/tmp/out.js; grep -q smoke_ok /tmp/out.js
Output: sh: 1: set: Illegal option -o pipefail
Smoke [FAIL]: printf "export const x = 42; export function id(v){ return v; }" > /tmp/dep.js; printf "import { x, id } from './dep.js'; console.log('ok', id(x));" > /tmp/main.js; esbuild /tmp/main.js --bundle --outfile=/tmp/out2.js; grep -q ok /tmp/out2.js
Output: sh: 1: set: Illegal option -o pipefail# syntax=docker/dockerfile:1
FROM golang:trixie AS builder
ENV CGO_ENABLED=0
RUN apt-get update -y && \
apt-get install -y --no-install-recommends ca-certificates curl tar gcc libc6-dev make nodejs && \
ln -s /usr/bin/nodejs /usr/bin/node && \
rm -rf /var/lib/apt/lists/*
WORKDIR /src
COPY . .
RUN make esbuild
FROM debian:bookworm-slim
RUN apt-get update -y && \
apt-get install -y --no-install-recommends ca-certificates bash && \
ln -sf /bin/bash /bin/sh && \
rm -rf /var/lib/apt/lists/*
COPY --from=builder /src/esbuild /usr/local/bin/esbuild
RUN chmod +x /usr/local/bin/esbuild
ENTRYPOINT ["esbuild"]
- Exact error message and exit code
- Error: ln: failed to create symbolic link '/usr/bin/node': File exists
- Exit code: 1
- Failing command/step
- Failing step (Dockerfile stage builder 2/5):
RUN apt-get update -y && apt-get install -y --no-install-recommends ca-certificates curl tar gcc libc6-dev make nodejs && ln -s /usr/bin/nodejs /usr/bin/node && rm -rf /var/lib/apt/lists/*
- Missing packages or files mentioned
- None explicitly missing; the failure is due to attempting to create a symlink where /usr/bin/node already exists (File exists) during the ln -s step.
- Version mismatch info
- Observed environment details:
- Node.js package version installed: nodejs 20.19.2+dfsg-1+deb13u2
- libnode115: 20.19.2+dfsg-1+deb13u2
- libc6-dev: 2.41-12+deb13u3
- Debian base indicated in logs shows bookworm-slim in Stage-1, but apt sources/references during build reference trixie (mixed Debian codenames in the build).
- In short, there appears to be a distribution/codename mismatch during the build (stage uses bookworm-slim while apt sources reference trixie), alongside a node symlink conflict.# syntax=docker/dockerfile:1
# Build stage: use Go 1.13-compatible environment and install esbuild dependencies
FROM golang:trixie AS builder
ENV CGO_ENABLED=0
# Install dependencies required by the build script and esbuild tooling
RUN apt-get update -y && \
DEBIAN_FRONTEND=noninteractive \
apt-get install -y --no-install-recommends ca-certificates curl tar gcc libc6-dev make nodejs npm && \
rm -rf /var/lib/apt/lists/*
WORKDIR /src
COPY . .
# The Makefile esbuild target compiles esbuild from source
RUN make esbuild
# Final runtime image
FROM debian:bookworm-slim
RUN apt-get update -y && \
DEBIAN_FRONTEND=noninteractive \
apt-get install -y --no-install-recommends ca-certificates bash ca-certificates xz-utils && \
rm -rf /var/lib/apt/lists/*
# Copy the built esbuild binary into the runtime image
COPY --from=builder /src/esbuild /usr/local/bin/esbuild
# Ensure the binary is executable
RUN chmod +x /usr/local/bin/esbuild
# Default command
ENTRYPOINT ["/usr/local/bin/esbuild"]