Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 115 additions & 0 deletions .github/workflows/build-docker-images.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: Build Docker Images

on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'docker/**'

permissions:
contents: read
packages: write

jobs:
build-alpine:
name: Build Alpine image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Alpine image
uses: docker/build-push-action@v5
with:
context: .
file: docker/alpine.Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ghcr.io/${{ github.repository }}/nodejs-rust:alpine
cache-from: type=gha
cache-to: type=gha,mode=max

build-debian:
name: Build Debian image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Debian image
uses: docker/build-push-action@v5
with:
context: .
file: docker/debian.Dockerfile
platforms: linux/amd64
push: true
tags: ghcr.io/${{ github.repository }}/nodejs-rust:debian
cache-from: type=gha
cache-to: type=gha,mode=max

build-debian-aarch64:
name: Build Debian ARM64 image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm64

- name: Install latest libc++-dev for cross build
uses: addnab/docker-run-action@v3
with:
image: node:lts-slim
options: '--platform linux/arm64 --user 0:0 -v ${{ github.workspace }}/lib/llvm-18:/usr/lib/llvm-18'
run: >-
apt-get update &&
apt-get install -y wget gnupg2 &&
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - &&
echo "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-18 main" >> /etc/apt/sources.list &&
echo "deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal-18 main" >> /etc/apt/sources.list &&
apt-get update &&
apt-get install libc++-18-dev libc++abi-18-dev -y --fix-missing --no-install-recommends &&
rm /usr/lib/llvm-18/lib/libc++abi.so

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Debian ARM64 image
uses: docker/build-push-action@v5
with:
context: .
file: docker/debian-aarch64.Dockerfile
platforms: linux/amd64
push: true
tags: ghcr.io/${{ github.repository }}/nodejs-rust:debian-aarch64
cache-from: type=gha
cache-to: type=gha,mode=max
12 changes: 7 additions & 5 deletions .github/workflows/publish_to_npm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ jobs:
- host: windows-latest
build: |
yarn set version 3
yarn build
rustup target add x86_64-pc-windows-msvc
yarn build --target x86_64-pc-windows-msvc
target: x86_64-pc-windows-msvc
- host: ubuntu-latest
target: x86_64-unknown-linux-gnu
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
docker: ghcr.io/${{ github.repository }}/nodejs-rust:debian
build: |-
set -e
rustup update stable
Expand All @@ -44,7 +45,7 @@ jobs:
strip *.node
- host: ubuntu-latest
target: x86_64-unknown-linux-musl
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
docker: ghcr.io/${{ github.repository }}/nodejs-rust:alpine
build: |-
set -e
rustup update stable
Expand All @@ -60,7 +61,7 @@ jobs:
strip -x *.node
- host: ubuntu-latest
target: aarch64-unknown-linux-gnu
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64
docker: ghcr.io/${{ github.repository }}/nodejs-rust:debian-aarch64
build: |-
set -e
rustup update stable
Expand All @@ -71,7 +72,8 @@ jobs:
target: aarch64-pc-windows-msvc
build: |
yarn set version 3
yarn build
rustup target add aarch64-pc-windows-msvc
yarn build --target aarch64-pc-windows-msvc
name: stable - ${{ matrix.settings.target }} - node@22
runs-on: ${{ matrix.settings.host }}
steps:
Expand Down
5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ crate-type = ["cdylib"]

[dependencies]
# Default enable napi4 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix
napi = { version = "3.5.2", default-features = false, features = [
napi = { version = "3.6.0", default-features = false, features = [
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

napi crate 3.6.0 crates.io breaking changes

💡 Result:

Do you mean the napi crate version 3.6.0 (napi v3.6.0)? I can't find a release/tag for "napi 3.6.0" in the napi-rs changelogs or on crates.io — do you want breaking changes for napi v3 (the v3 migration) or for a different specific version (please paste a link or exact version)?


🌐 Web query:

napi-derive crate 3.4.0 crates.io breaking changes

💡 Result:

I couldn't find a napi-derive 3.4.0 release on crates.io or in the official changelogs — latest documented napi-derive releases in the official changelog are 3.0.0-beta.* (and site tools show 3.1.1 as a recent stable). See the napi-derive changelog and package listings for available versions. (napi.rs)

Citations:


🌐 Web query:

napi-rs 3.6.0 3.4.0 compatibility @napi-rs/cli 3.5.0

💡 Result:

Short answer: yes — @napi-rs/cli@3.5.0 is intended to work across napi-rs v3.x releases, so napi-rs 3.4.0 and 3.6.0 are compatible in practice. The v3 line (napi v3 + @napi-rs/cli v3) is the intended compatibility surface; earlier strict version-enforcement checks were relaxed in the CLI. [1][2]

Sources:

  • napi-rs changelog (v3 series). [1]
  • @napi-rs/cli docs / changelog (CLI v3, and note about CLI version-check behavior). [2]

The specified napi and napi-derive versions do not exist on crates.io.

The Cargo.toml references napi 3.6.0 and napi-derive 3.4.0, but these versions are not available on crates.io. The latest documented napi-derive release is 3.1.1, and napi 3.6.0 does not appear in official changelogs. Verify the correct version numbers and update Cargo.toml accordingly, or confirm these are intentional pre-releases/local versions.

🤖 Prompt for AI Agents
In Cargo.toml around line 11, the specified napi = "3.6.0" and napi-derive =
"3.4.0" are not present on crates.io; update the dependency declarations to
point to published, compatible versions (for example set napi-derive to the
latest released 3.1.1 or another verified napi-derive release and pick a
matching napi release that exists), or if these are intentional
pre-release/local builds replace the version entries with the appropriate git =
"...", tag = "...", or path = "..." specification so Cargo can resolve them;
ensure both napi and napi-derive versions are compatible with each other and run
cargo update / cargo check to verify resolution.

"napi9",
"async",
"serde-json",
"dyn-symbols", # needed for windows build to include "libloading" crate
] }
napi-derive = "3.3.3"
napi-derive = "3.4.0"
serde = { version = "1", features = ["derive"] }
alloy-dyn-abi = "1.1"
tokio = { version = "1", features = ["rt-multi-thread"] }
Expand Down
28 changes: 28 additions & 0 deletions docker/alpine.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM node:22-alpine

ENV PATH="/aarch64-linux-musl-cross/bin:/usr/local/cargo/bin/rustup:/root/.cargo/bin:$PATH" \
RUSTFLAGS="-C target-feature=-crt-static" \
CC="clang" \
CXX="clang++" \
GN_EXE=gn

RUN apk add --update --no-cache bash wget cmake musl-dev clang llvm build-base python3 && \
sed -i -e 's/v[[:digit:]]\..*\//edge\//g' /etc/apk/repositories && \
apk add --update --no-cache --repository https://dl-cdn.alpinelinux.org/alpine/edge/testing \
rustup \
git \
gn \
tar \
ninja && \
apk update && \
apk upgrade

RUN rustup-init -y && \
rustup update stable && \
rustup default stable && \
yarn global add pnpm lerna && \
rustup target add aarch64-unknown-linux-musl && \
rustup target add x86_64-unknown-linux-musl && \
wget https://github.com/napi-rs/napi-rs/releases/download/linux-musl-cross%4010/aarch64-linux-musl-cross.tgz && \
tar -xvf aarch64-linux-musl-cross.tgz && \
rm aarch64-linux-musl-cross.tgz
47 changes: 47 additions & 0 deletions docker/debian-aarch64.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
FROM messense/manylinux2014-cross:aarch64

ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \
CC=clang \
CC_aarch64_unknown_linux_gnu=clang \
CXX=clang++ \
CXX_aarch64_unknown_linux_gnu=clang++ \
CFLAGS="--sysroot=/usr/aarch64-unknown-linux-gnu/aarch64-unknown-linux-gnu/sysroot" \
CXXFLAGS="--sysroot=/usr/aarch64-unknown-linux-gnu/aarch64-unknown-linux-gnu/sysroot" \
C_INCLUDE_PATH="/usr/aarch64-unknown-linux-gnu/aarch64-unknown-linux-gnu/sysroot/usr/include" \
LDFLAGS="-L/usr/aarch64-unknown-linux-gnu/lib/llvm-18/lib"

ADD ./lib/llvm-18 /usr/aarch64-unknown-linux-gnu/lib/llvm-18

RUN apt-get update && \
apt-get install -y --fix-missing --no-install-recommends curl gnupg gpg-agent ca-certificates openssl && \
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
curl -fsSL https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --dearmor -o /etc/apt/keyrings/llvm-snapshot.gpg && \
echo "deb [signed-by=/etc/apt/keyrings/llvm-snapshot.gpg] http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main" >> /etc/apt/sources.list && \
echo "deb-src [signed-by=/etc/apt/keyrings/llvm-snapshot.gpg] http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main" >> /etc/apt/sources.list && \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" > /etc/apt/sources.list.d/nodesource.list && \
apt-get update && \
apt-get install -y --fix-missing --no-install-recommends \
llvm-18 \
clang-18 \
lld-18 \
libc++-18-dev \
libc++abi-18-dev \
nodejs \
xz-utils \
rcs \
git \
make \
cmake \
ninja-build && \
apt-get autoremove -y && \
curl https://sh.rustup.rs -sSf | sh -s -- -y && \
rustup update stable && \
rustup default stable && \
rustup target add aarch64-unknown-linux-gnu && \
corepack enable && \
ln -sf /usr/bin/clang-18 /usr/bin/clang && \
ln -sf /usr/bin/clang++-18 /usr/bin/clang++ && \
ln -sf /usr/bin/lld-18 /usr/bin/lld && \
ln -sf /usr/bin/clang-18 /usr/bin/cc
59 changes: 59 additions & 0 deletions docker/debian.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
FROM messense/manylinux2014-cross:x86_64

ARG NASM_VERSION=2.16.01

ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \
CC=clang \
CXX=clang++ \
CC_x86_64_unknown_linux_gnu=clang \
CXX_x86_64_unknown_linux_gnu=clang++ \
RUST_TARGET=x86_64-unknown-linux-gnu

RUN apt-get update && \
apt-get install -y --fix-missing --no-install-recommends curl gnupg gpg-agent ca-certificates openssl && \
mkdir -p /etc/apt/keyrings && \
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
curl -fsSL https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --dearmor -o /etc/apt/keyrings/llvm-snapshot.gpg && \
echo "deb [signed-by=/etc/apt/keyrings/llvm-snapshot.gpg] http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main" >> /etc/apt/sources.list && \
echo "deb-src [signed-by=/etc/apt/keyrings/llvm-snapshot.gpg] http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main" >> /etc/apt/sources.list && \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" > /etc/apt/sources.list.d/nodesource.list && \
apt-get update && \
apt-get install -y --fix-missing --no-install-recommends \
llvm-18 \
clang-18 \
lld-18 \
libc++-18-dev \
libc++abi-18-dev \
nodejs \
xz-utils \
rcs \
git \
make \
cmake \
ninja-build && \
apt-get autoremove -y && \
curl https://sh.rustup.rs -sSf | sh -s -- -y && \
rustup update stable && \
rustup default stable && \
corepack enable && \
ln -sf /usr/bin/clang-18 /usr/bin/clang && \
ln -sf /usr/bin/clang++-18 /usr/bin/clang++ && \
ln -sf /usr/bin/lld-18 /usr/bin/lld && \
ln -sf /usr/bin/clang-18 /usr/bin/cc

RUN wget https://www.nasm.us/pub/nasm/releasebuilds/${NASM_VERSION}/nasm-${NASM_VERSION}.tar.xz && \
tar -xf nasm-${NASM_VERSION}.tar.xz && \
cd nasm-${NASM_VERSION} && \
./configure --prefix=/usr/ && \
make && \
make install && \
cd / && \
rm -rf nasm-${NASM_VERSION} && \
rm nasm-${NASM_VERSION}.tar.xz

ENV LDFLAGS="-fuse-ld=lld --sysroot=/usr/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/sysroot" \
CFLAGS="--sysroot=/usr/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/sysroot" \
CXXFLAGS="--sysroot=/usr/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/sysroot" \
C_INCLUDE_PATH="/usr/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/sysroot/usr/include"
Loading