diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 5b1b3262..56905b47 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -40,12 +40,24 @@ jobs: node_arch: arm64 cpp_arch: amd64_arm64 - # Alpine + # Musl Alpine - os: ubuntu-22.04 dockerfile: docker/alpine.dockerfile node_arch: x64 cpp_arch: x64 + # Debian Arm + - os: macos-14 + node_arch: arm64 + cpp_arch: amd64_arm64 + dockerfile: docker/alpine.dockerfile + + # Musl Alpine Arm + - os: macos-14 + node_arch: arm64 + cpp_arch: amd64_arm64 + dockerfile: docker/debian.dockerfile + env: npm_config_arch: ${{ matrix.node_arch }} npm_config_target_arch: ${{ matrix.node_arch }} @@ -137,7 +149,8 @@ jobs: run: | docker build -t zeromq -f ${{ matrix.dockerfile }} . docker create --name zeromq-temp zeromq - docker cp zeromq-temp:/app/build ./build + mkdir -p ./build + docker cp zeromq-temp:/app/build ./ docker rm -f zeromq-temp - name: Upload build diff --git a/docker/alpine.dockerfile b/docker/alpine.dockerfile index 21a99e5c..407e7a5e 100644 --- a/docker/alpine.dockerfile +++ b/docker/alpine.dockerfile @@ -1,9 +1,11 @@ -FROM node:18-alpine +FROM node:18-alpine AS builder WORKDIR /app COPY ./ ./ ENV VCPKG_FORCE_SYSTEM_BINARIES=1 -RUN apk add --no-cache \ +RUN \ + # system dependencies + apk add --no-cache \ bash \ build-base \ curl \ @@ -23,6 +25,16 @@ RUN apk add --no-cache \ autoconf \ libtool && \ cp /usr/lib/ninja-build/bin/ninja /usr/bin/ninja && \ + # build npm i -g pnpm && \ pnpm install && \ pnpm run build + +FROM node:18-alpine +WORKDIR /app + +COPY ./ ./ +COPY --from=builder /app/build ./build +COPY --from=builder /app/node_modules ./node_modules + + diff --git a/docker/debian.dockerfile b/docker/debian.dockerfile new file mode 100644 index 00000000..c351248b --- /dev/null +++ b/docker/debian.dockerfile @@ -0,0 +1,37 @@ +FROM node:18 AS builder + +WORKDIR /app +COPY ./ ./ +ENV VCPKG_FORCE_SYSTEM_BINARIES=1 +RUN \ + # system dependencies + apt-get update -y && \ + apt-get install --no-install-recommends -y \ + bash \ + build-essential \ + curl \ + git \ + g++ \ + make \ + ninja-build \ + pkg-config \ + unzip \ + zip \ + python3 \ + tar \ + cmake \ + ninja-build \ + automake \ + autoconf \ + libtool && \ + # build + npm i -g pnpm && \ + pnpm install && \ + pnpm run build + +FROM node:18 +WORKDIR /app + +COPY ./ ./ +COPY --from=builder /app/build ./build +COPY --from=builder /app/node_modules ./node_modules