diff --git a/.github/workflows/build-docker-images.yaml b/.github/workflows/build-docker-images.yaml index 85c4d35..4a2fbae 100644 --- a/.github/workflows/build-docker-images.yaml +++ b/.github/workflows/build-docker-images.yaml @@ -1,3 +1,5 @@ +# Taken from https://github.com/napi-rs/napi-rs/blob/main/.github/workflows/docker.yaml +# and modified to build with latest rust and node 22 name: Build Docker Images on: @@ -6,7 +8,7 @@ on: branches: - main paths: - - 'docker/**' + - "docker/**" permissions: contents: read @@ -85,7 +87,7 @@ jobs: 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' + 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 && @@ -112,4 +114,4 @@ jobs: push: true tags: ghcr.io/${{ github.repository }}/nodejs-rust:debian-aarch64 cache-from: type=gha - cache-to: type=gha,mode=max \ No newline at end of file + cache-to: type=gha,mode=max diff --git a/.github/workflows/publish_to_npm.yaml b/.github/workflows/publish_to_npm.yaml index c39a343..64a7a7d 100644 --- a/.github/workflows/publish_to_npm.yaml +++ b/.github/workflows/publish_to_npm.yaml @@ -11,6 +11,7 @@ env: permissions: contents: write id-token: write + packages: read on: workflow_dispatch: null @@ -39,7 +40,6 @@ jobs: docker: ghcr.io/${{ github.repository }}/nodejs-rust:debian build: |- set -e - rustup update stable yarn set version 3 yarn build --target x86_64-unknown-linux-gnu strip *.node @@ -48,7 +48,6 @@ jobs: docker: ghcr.io/${{ github.repository }}/nodejs-rust:alpine build: |- set -e - rustup update stable yarn set version 3 yarn build --target x86_64-unknown-linux-musl strip *.node @@ -64,7 +63,6 @@ jobs: docker: ghcr.io/${{ github.repository }}/nodejs-rust:debian-aarch64 build: |- set -e - rustup update stable yarn set version 3 yarn build --target aarch64-unknown-linux-gnu aarch64-unknown-linux-gnu-strip *.node @@ -123,6 +121,16 @@ jobs: check-latest: true cache: yarn architecture: x86 + - name: Log in to GitHub Container Registry + if: ${{ matrix.settings.docker }} + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Pull Docker image + if: ${{ matrix.settings.docker }} + run: docker pull ${{ matrix.settings.docker }} - name: Build in docker uses: addnab/docker-run-action@v3 if: ${{ matrix.settings.docker }} diff --git a/docker/alpine.Dockerfile b/docker/alpine.Dockerfile index a0efc3e..32f9bd9 100644 --- a/docker/alpine.Dockerfile +++ b/docker/alpine.Dockerfile @@ -6,18 +6,11 @@ ENV PATH="/aarch64-linux-musl-cross/bin:/usr/local/cargo/bin/rustup:/root/.cargo 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 apk add --update --no-cache bash wget cmake musl-dev clang llvm build-base python3 git tar ninja && \ + wget https://sh.rustup.rs -O rustup-init.sh && \ + chmod +x rustup-init.sh -RUN rustup-init -y && \ +RUN ./rustup-init.sh -y && \ rustup update stable && \ rustup default stable && \ yarn global add pnpm lerna && \ @@ -25,4 +18,5 @@ RUN rustup-init -y && \ 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 \ No newline at end of file + rm aarch64-linux-musl-cross.tgz && \ + rm rustup-init.sh \ No newline at end of file