# Build WebDNN from source with Node.js and Python tooling
FROM node:14-bullseye
# Install system dependencies: Python, build tools, Git, and curl
RUN apt-get update && \
apt-get install -y --no-install-recommends \
python3 \
python3-pip \
ca-certificates \
curl \
gnupg \
build-essential \
git && \
rm -rf /var/lib/apt/lists/*
# Install Emscripten SDK for WebAssembly build (required for wasm backend in build)
RUN git clone https://github.com/emscripten-core/emsdk.git /emsdk && \
/bin/bash -lc 'source /emsdk/emsdk_env.sh && emsdk install latest && emsdk activate latest'
# Ensure emscripten tools are on PATH
ENV PATH=/emsdk:/emsdk/upstream/emscripten:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# Create and set workdir
WORKDIR /workspace
# Copy manifests first to leverage build cache
COPY package.json yarn.lock ./
# Install Node.js dependencies
RUN npm install
# Copy the rest of the repository
COPY . .
# Build the project from source (includes wasm and webgpu shader components)
RUN npm run build:all
# Expose nothing by default; container can run a server or shell as needed
CMD ["bash"]
node_modules/ dist/ .dockerignore Dockerfile README* *.md example/ *.log *.cache node_modules
Summary of Docker build error (concise, preserving key details) - Exact error message and exit code - sh: 1: python: not found - Exit code: 1 - Failing command/step - Step: [8/8] RUN npm run build:all - Failing internal command: shader:wasm (invoked by build:all), which runs python src/shader/wasm/compile.py - Missing packages or files mentioned - python: not found (ENOENT) - Note: python3 is installed (Python 3.9.2 per logs) but there is no /usr/bin/python alias, i.e., the build expects a python interpreter named python - Version mismatch information - No explicit version mismatch reported. The issue is absence of the python binary, even though Python 3 is installed (python3) and used for other tasks (e.g., python3-pip). No mismatch between tool versions is shown; instead a missing executable causes the failure. Context note - The build proceeds up to npm run build:all, then fails during shader/wasm compilation due to missing python binary. Installing a python binary named python (or symlinking python3 to python) should resolve this step.
# Build WebDNN from source with Node.js and Python tooling
FROM node:14-bullseye
# Install system dependencies: Python, build tools, Git, and curl
RUN apt-get update && \
apt-get install -y --no-install-recommends \
python3 \
python3-pip \
python-is-python3 \
ca-certificates \
curl \
gnupg \
build-essential \
git && \
rm -rf /var/lib/apt/lists/*
# Ensure python is available as /usr/bin/python (via python-is-python3 or symlink)
RUN ln -s /usr/bin/python3 /usr/bin/python 2>/dev/null || true
# Create and set workdir
WORKDIR /workspace
# Copy manifests first to leverage build cache
COPY package.json yarn.lock ./
# Install Node.js dependencies
RUN npm install
# Copy the rest of the repository
COPY . .
# Build the project from source (includes wasm and webgpu shader components)
RUN npm run build:all
# Expose nothing by default; container can run a server or shell as needed
CMD ["bash"]
Failing step - RUN npm run build:all (Dockerfile step 8/8) Exact error messages and exit codes - FileNotFoundError: [Errno 2] No such file or directory: 'emcc' - npm ERR! code ELIFECYCLE - npm ERR! errno 1 - npm ERR! webdnn@2.0.0 shader:wasm: `python src/shader/wasm/compile.py` - npm ERR! Exit status 1 - npm ERR! code ELIFECYCLE - npm ERR! errno 1 - npm ERR! webdnn@2.0.0 build:all: `npm run shader:wasm && npm run shader:webgpu && npm run makeShaderList && npm run build && npm run build:core` - npm ERR! Exit status 1 - ERROR: failed to build: failed to solve: process "/bin/sh -c npm run build:all" did not complete successfully: exit code: 1 What failed and missing - The shader:wasm step fails because emcc (Emscripten compiler) is not found: - FileNotFoundError: [Errno 2] No such file or directory: 'emcc' - Missing file/binary mentioned: emcc (Emscripten compiler) is not installed or not in PATH. Version/mismatch notes - Base image: node:14-bullseye (Debian bullseye) - No explicit version mismatch is reported; the failure is due to missing emcc, not a version conflict.
# Build WebDNN from source with Node.js and Python tooling
FROM node:14-bullseye
# Install system dependencies: Python, build tools, Git, and curl
RUN apt-get update && \
apt-get install -y --no-install-recommends \
python3 \
python3-pip \
ca-certificates \
curl \
git \
build-essential \
wget \
unzip \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Ensure python is available as /usr/bin/python (via python-is-python3 alias or symlink)
RUN ln -s /usr/bin/python3 /usr/bin/python 2>/dev/null || true
# Install Emscripten SDK for WebAssembly build (required for wasm backend in build)
RUN git clone https://github.com/emscripten-core/emsdk.git /emsdk && \
cd /emsdk && \
./emsdk install latest && \
./emsdk activate latest && \
. ./emsdk_env.sh
# Ensure emscripten tools are on PATH
ENV PATH=/emsdk:/emsdk/upstream/emscripten:${PATH}
# Create and set workdir
WORKDIR /workspace
# Copy manifests first to leverage build cache
COPY package.json ./
# Install Node.js dependencies
RUN npm install
# Copy the rest of the repository
COPY . .
# Build the project from source (includes wasm and webgpu shader components)
RUN npm run build:all
# Expose nothing by default; container can run a server or shell as needed
CMD ["bash"]
- Exact error message and exit code - AssertionError: emscripten requires python 3.10 or above (/usr/bin/python3 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110]) - Exit code: 1 (manifests as a subprocess.CalledProcessError for the emcc call; npm exits with ELIFECYCLE and Exit status 1) - Failing command/step - RUN npm run build:all (Dockerfile:9/9) - Within this, the shader:wasm step runs python src/shader/wasm/compile.py, which invokes emcc and fails with the above assertion. - Missing packages or files mentioned - No missing packages/files cited. The issue is the Python version. - Version mismatch information - emscripten requires Python 3.10 or above - Current Python version in the image: 3.9.2 (/usr/bin/python3 3.9.2) - This is the root cause of the failure during emcc invocation in the build.
# Build WebDNN from source with Node.js and Python tooling
FROM node:18-bullseye
# Install system dependencies: Python3.10 (built from source), build tools, Git, and curl
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
curl \
gnupg \
build-essential \
git \
wget \
libssl-dev \
zlib1g-dev \
libncurses5-dev \
libreadline-dev \
libsqlite3-dev \
libbz2-dev \
libffi-dev \
liblzma-dev \
tk-dev \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Build Python 3.10 from source to satisfy emsdk requirement
ENV PYTHON_VERSION=3.10.13
WORKDIR /tmp
RUN set -eux; \
export DEBIAN_FRONTEND=noninteractive; \
wget https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tar.xz -O Python-${PYTHON_VERSION}.tar.xz; \
tar -xf Python-${PYTHON_VERSION}.tar.xz; \
cd Python-${PYTHON_VERSION}; \
./configure --enable-optimizations; \
make -j$(nproc); \
make altinstall; \
cd /; \
rm -rf /tmp/Python-${PYTHON_VERSION}*
# Ensure python is available as /usr/bin/python (alias to python3.10)
RUN ln -s /usr/local/bin/python3.10 /usr/bin/python
# Install Emscripten SDK for WebAssembly build (required for wasm backend in build)
RUN git clone https://github.com/emscripten-core/emsdk.git /emsdk && \
/bin/bash -lc 'cd /emsdk && ./emsdk install latest && ./emsdk activate latest' && \
echo 'source /emsdk/emsdk_env.sh' >> /root/.bashrc
# Ensure emscripten tools are on PATH
ENV PATH=/emsdk:/emsdk/upstream/emscripten:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# Create and set workdir
WORKDIR /workspace
# Copy manifests first to leverage build cache
COPY package.json ./
# Install Node.js dependencies
RUN npm install
# Copy the rest of the repository
COPY . .
# Build the project from source (includes wasm and webgpu shader components)
RUN npm run build:all
# Expose nothing by default; container can run a server or shell as needed
CMD ["bash"]
Build timed out after 600s
FROM node:18-bullseye-slim # Basic metadata LABEL maintainer="WebDNN BuildAgent" # Non-interactive apt ENV DEBIAN_FRONTEND=noninteractive # Install system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ ca-certificates \ curl \ git \ python3 \ python3-pip \ build-essential \ && rm -rf /var/lib/apt/lists/* # Install yarn (consistently with yarn.lock) RUN npm i -g yarn # Install Emscripten SDK (needed for wasm shader compilation) RUN git clone https://github.com/emscripten-core/emsdk.git /emsdk ENV EMSDK="/emsdk" # Install and activate the latest toolchain RUN /bin/bash -lc "cd /emsdk && ./emsdk install latest && ./emsdk activate latest" # Ensure a python binary named 'python' exists (Python 3 is installed as python3) RUN if [ ! -e /usr/bin/python ]; then ln -s /usr/bin/python3 /usr/bin/python; fi # Copy source code into the image COPY . /workspace WORKDIR /workspace # Build the project from source # Build is performed in a single shell to preserve emsdk environment for the duration RUN /bin/bash -lc ". /emsdk/emsdk_env.sh && yarn install && yarn build:all" # Clean up apt artifacts to reduce image size RUN apt-get clean && rm -rf /var/lib/apt/lists/* # Default to an interactive shell CMD ["bash"]
Concerns: Potentially large image size due to copying the entire repository and installing a full Emscripten SDK; consider adding a .dockerignore to exclude node_modules and build artifacts and pinning emsdk version for reproducibility., Runtime PATH may not include emsdk tools after build since emsdk_env.sh is only sourced during the build step; if runtime tooling is needed, consider adding equivalent PATH setup in the final image or relying solely on prebuilt artifacts.
# Multi-stage build for WebDNN
# Stage 1: Build with emscripten and Node.js tooling
FROM emscripten/emsdk:latest AS build
# Install system dependencies including Node.js, Python tooling, and build essentials
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl \
ca-certificates \
git \
build-essential \
cmake \
python3 \
python3-pip \
wget \
|| true && \
rm -rf /var/lib/apt/lists/*
# Install Node.js 18.x (LTS) using NodeSource
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
apt-get update && \
apt-get install -y --no-install-recommends nodejs && \
rm -rf /var/lib/apt/lists/*
# Set build context
WORKDIR /workspace
# Copy package manifests first to leverage caching
COPY package.json yarn.lock* ./
# Install npm/yarn dependencies
RUN npm install -g yarn && \
yarn install --frozen-lockfile
# Copy the rest of the source
COPY . .
# Build the project (this will also build shaders via the included scripts)
RUN yarn build:all
# Stage 2: Lightweight runtime image that serves the built artifacts
FROM node:18-bullseye-slim AS runtime
WORKDIR /workspace
# Copy built artifacts from the build stage
COPY --from=build /workspace/dist /workspace/dist
# Expose a convenient port for the static server
EXPOSE 8080
# Serve the built distribution using a tiny static HTTP server via npx
CMD ["npx", "http-server", "dist", "-p", "8080", "-c", "-1"]
- Exact error message and exit code - sh: 1: python: not found - Exit code: 127 - Failing command/step - Step: RUN yarn build:all (build 8/8) - Inside the step: npm run shader:wasm && npm run shader:webgpu && npm run makeShaderList && npm run build && npm run build:core - The failure occurs during: npm run shader:wasm -> python src/shader/wasm/compile.py (Python script execution) - Missing packages or files mentioned - The Python interpreter is not found (the image has python3 installed, but the plain python binary is missing) - Version mismatch / related info - Node.js 18.x is no longer actively supported (DEPRECATION WARNING from NodeSource) - Node.js installed: nodejs 18.20.8-1nodesource1 - npm reported a newer major version available: 11.12.0 (current 10.9.2) - Build context shows Python3 and pip were installed earlier, but the python binary (Python 2/legacy python) is not present, causing the failure Cause: The shader build script expects a python executable named python, which is absent in the image; installing python (or creating a python symlink to python3) would resolve it.
# Multi-stage build for WebDNN
# Stage 1: Build with emscripten and Node.js tooling
FROM emscripten/emsdk:latest AS build
# Install system dependencies including Node.js, Python tooling, and build essentials
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl \
ca-certificates \
git \
build-essential \
cmake \
python3 \
python3-pip \
wget \
&& rm -rf /var/lib/apt/lists/*
# Ensure python binary exists for shader scripts (some scripts expect 'python')
RUN ln -s /usr/bin/python3 /usr/bin/python || true
# Install Node.js 18.x (LTS) using NodeSource
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
apt-get update && \
apt-get install -y --no-install-recommends nodejs && \
rm -rf /var/lib/apt/lists/*
# Set build context
WORKDIR /workspace
# Copy package manifests first to leverage caching
COPY package.json yarn.lock* ./
# Install npm/yarn dependencies
RUN npm install -g yarn && \
yarn install --frozen-lockfile
# Copy the rest of the source
COPY . .
# Build the project (this will also build shaders via the included scripts)
RUN yarn build:all
# Stage 2: Lightweight runtime image that serves the built artifacts
FROM node:18-bullseye-slim AS runtime
WORKDIR /workspace
# Copy built artifacts from the build stage
COPY --from=build /workspace/dist /workspace/dist
# Install a lightweight static server
RUN npm install -g http-server
# Expose a convenient port for the static server
EXPOSE 8080
# Serve the built distribution using a tiny static HTTP server
CMD ["http-server", "dist", "-p", "8080", "-c", "-1"]
Summary (under 1500 chars):
- Failing command/step:
- RUN yarn build:all during the final build (Dockerfile: line 41; build step 9/9).
- Exact error message and exit code:
- Error: error:0308010C:digital envelope routines::unsupported
- at new Hash (node:internal/crypto/hash:79:19)
- at Object.createHash (node:crypto:139:10)
- at BulkUpdateDecorator.hashFactory (/workspace/node_modules/webpack/lib/util/createHash.js:144:18)
- at BulkUpdateDecorator.update (/workspace/node_modules/webpack/lib/util/createHash.js:46:50)
- at RawSource.updateHash (/workspace/node_modules/webpack-sources/lib/RawSource.js:64:8)
- at NormalModule._initBuildHash (/workspace/node_modules/webpack/lib/NormalModule.js:853:17)
- ... (trace continues)
- opensslErrorStack: [
'error:03000086:digital envelope routines::initialization error',
'error:0308010C:digital envelope routines::unsupported'
]
- library: 'digital envelope routines'
- reason: 'unsupported'
- code: 'ERR_OSSL_EVP_UNSUPPORTED'
- Node.js v22.16.0
- Exit code: 1
- Missing packages or files mentioned:
- None explicitly mentioned as missing.
- Version mismatch / related info:
- Node.js version shown during failure: v22.16.0
- Earlier steps installed Node.js 18.x (e.g., nodejs 18.20.8), indicating a Node version mismatch inside the build. The OpenSSL-related error is typical when using newer Node/OpenSSL combos with webpack.# Multi-stage build for WebDNN
# Stage 1: Build with emscripten and Node.js tooling
FROM emscripten/emsdk:latest AS build
# Install system dependencies including Node.js, Python tooling, and build essentials
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl \
ca-certificates \
git \
build-essential \
cmake \
python3 \
python3-pip \
wget \
&& rm -rf /var/lib/apt/lists/*
# Ensure python binary exists for shader scripts (some scripts expect 'python')
RUN ln -s /usr/bin/python3 /usr/bin/python || true
# Install Node.js 18.x (LTS) using NodeSource
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
apt-get update && \
apt-get install -y --no-install-recommends nodejs && \
rm -rf /var/lib/apt/lists/*
# Work directory
WORKDIR /workspace
# Make sure OpenSSL legacy provider is available for webpack builds on newer Node
ENV NODE_OPTIONS=--openssl-legacy-provider
# Copy package manifests first to leverage caching
COPY package.json yarn.lock* ./
# Install npm/yarn dependencies
RUN npm install -g yarn && \
yarn install --frozen-lockfile
# Copy the rest of the source
COPY . .
# Build the project (this will also build shaders via the included scripts)
RUN yarn build:all
# Stage 2: Lightweight runtime image that serves the built artifacts
FROM node:18-bullseye-slim AS runtime
WORKDIR /workspace
# Copy built artifacts from the build stage
COPY --from=build /workspace/dist /workspace/dist
# Install a lightweight static server
RUN npm install -g http-server
# Expose a convenient port for the static server
EXPOSE 8080
# Serve the built distribution using a tiny static HTTP server
CMD ["http-server", "dist", "-p", "8080", "-c", "-1"]
Concerns: The first stage uses FROM emscripten/emsdk:latest which can change between builds; pin to a specific version to ensure reproducible builds., COPY . . copies the entire repository into the build context; ensure a proper .dockerignore is in place to exclude large files or node_modules to keep the image size reasonable. Smoke [PASS]: test -d /workspace/dist