Skip to content

Commit

Permalink
Prebuild images also for arm64
Browse files Browse the repository at this point in the history
  • Loading branch information
orgads committed Oct 30, 2024
1 parent 685cb40 commit 4d2c6e4
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 24 deletions.
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.git
.gitignore
.dockerignore
Dockerfile*
examples
node_modules
out
prebuilds
spec
34 changes: 14 additions & 20 deletions .github/workflows/prebuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
os: [ macos-latest, windows-latest ]
steps:
- uses: actions/checkout@v4
- name: Use nodejs
Expand All @@ -30,38 +30,32 @@ jobs:
npm install --ignore-scripts
- name: Build
run: |
npx prebuild --target 18.0.0
npx prebuild --target 20.0.0
npx prebuild --target 22.0.0
npx -y prebuild
- name: Upload
run: |
npx prebuild --upload-all ${{ secrets.UPLOAD_TOKEN }}
npx -y prebuild --upload-all ${{ secrets.UPLOAD_TOKEN }}
env:
MAKEFLAGS: -j4

prebuild-alpine:
name: alpine
prebuild-linux:
name: ${{ matrix.os }}
runs-on: ubuntu-latest
container: node:alpine
strategy:
matrix:
os: [ debian, alpine ]
steps:
- uses: actions/checkout@v4
- name: Use nodejs
uses: actions/setup-node@v4
with:
node-version: latest
- name: Install build deps
run: |
apk add g++ make python3
- name: Dependencies
run: |
npm install --ignore-scripts
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build
run: |
npx prebuild --target 18.0.0
npx prebuild --target 20.0.0
npx prebuild --target 22.0.0
docker buildx build --platform linux/amd64,linux/arm64 . -f Dockerfile.${{ matrix.os }} --output prebuilds
- name: Upload
run: |
npx prebuild --upload-all ${{ secrets.UPLOAD_TOKEN }}
env:
MAKEFLAGS: -j4
npx -y prebuild --upload-all ${{ secrets.UPLOAD_TOKEN }}
4 changes: 2 additions & 2 deletions .prebuildrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"target": [
"18.20.4",
"20.16.0",
"22.5.1"
"20.18.0",
"22.11.0"
],
"strip": true
}
9 changes: 9 additions & 0 deletions Dockerfile.alpine
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM node:22-alpine3.20 AS build
WORKDIR /isolated-vm
RUN apk add g++ make python3
COPY . .
RUN npm install --ignore-scripts
RUN MAKEFLAGS=-j$(nproc) npx -y prebuild

FROM scratch
COPY --from=build /isolated-vm/prebuilds .
13 changes: 13 additions & 0 deletions Dockerfile.debian
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM node:22-bookworm-slim AS build
WORKDIR /isolated-vm
RUN apt-get update && \
apt-get install -y --no-install-recommends \
g++ \
make \
python3
COPY . .
RUN npm install --ignore-scripts
RUN MAKEFLAGS=-j$(nproc) npx -y prebuild

FROM scratch
COPY --from=build /isolated-vm/prebuilds .
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
"test": "node test.js"
},
"dependencies": {
"prebuild-install": "^7.1.1"
"prebuild-install": "^7.1.2"
},
"devDependencies": {
"isolated-vm": ".",
"prebuild": "^13.0.0"
"prebuild": "^13.0.1"
},
"binary": {
"module_path": "out"
Expand Down

0 comments on commit 4d2c6e4

Please sign in to comment.