diff --git a/.github/workflows/build-alpine.yml b/.github/workflows/build-alpine.yml index 516807dc..8be1f20f 100644 --- a/.github/workflows/build-alpine.yml +++ b/.github/workflows/build-alpine.yml @@ -39,19 +39,16 @@ jobs: context: . file: ./Dockerfile.alpine platforms: linux/amd64 - outputs: type=tar,dest=../out.tar + outputs: type=local, dest=dist - - name: Extract binaries from Docker image - run: | - tar xvf ../out.tar root/pkg-fetch/dist - - - name: Check if binary is compiled + - name: Check if binary is compiled, skip if download only id: check_file run: | - (test -f root/pkg-fetch/dist/*.sha256sum && echo "EXISTS=true" >> $GITHUB_OUTPUT) || echo "EXISTS=false" >> $GITHUB_OUTPUT + ls -l dist + (test -f dist/*.sha256sum && echo "EXISTS=true" >> $GITHUB_OUTPUT) || echo "EXISTS=false" >> $GITHUB_OUTPUT - uses: actions/upload-artifact@v4 if: steps.check_file.outputs.EXISTS == 'true' with: name: node${{ matrix.target-node }}-alpine-${{ matrix.target-arch }} - path: root/pkg-fetch/dist/* + path: dist/* diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index e8f3a852..19afc1d3 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -20,6 +20,7 @@ jobs: uses: docker/setup-buildx-action@v3 - name: Build + id: build uses: docker/build-push-action@v5 with: build-args: | @@ -27,22 +28,19 @@ jobs: context: . file: ./Dockerfile.linux platforms: linux/amd64 - outputs: type=tar,dest=../out.tar + outputs: type=local, dest=dist - - name: Extract binaries from Docker image - run: | - tar xvf ../out.tar root/pkg-fetch/dist - - - name: Check if binary is compiled + - name: Check if binary is compiled, skip if download only id: check_file run: | - (test -f root/pkg-fetch/dist/*.sha256sum && echo "EXISTS=true" >> $GITHUB_OUTPUT) || echo "EXISTS=false" >> $GITHUB_OUTPUT + ls -l dist + (test -f dist/*.sha256sum && echo "EXISTS=true" >> $GITHUB_OUTPUT) || echo "EXISTS=false" >> $GITHUB_OUTPUT - uses: actions/upload-artifact@v4 if: steps.check_file.outputs.EXISTS == 'true' with: name: node${{ matrix.target-node }}-linux-x64 - path: root/pkg-fetch/dist/* + path: dist/* linux-arm64: runs-on: ubuntu-20.04 @@ -59,6 +57,7 @@ jobs: uses: docker/setup-buildx-action@v3 - name: Build + id: build uses: docker/build-push-action@v5 with: build-args: | @@ -68,19 +67,16 @@ jobs: context: . file: ./Dockerfile.linuxcross platforms: linux/amd64 - outputs: type=tar,dest=../out.tar - - - name: Extract binaries from Docker image - run: | - tar xvf ../out.tar root/pkg-fetch/dist + outputs: type=local, dest=dist - - name: Check if binary is compiled + - name: Check if binary is compiled, skip if download only id: check_file run: | - (test -f root/pkg-fetch/dist/*.sha256sum && echo "EXISTS=true" >> $GITHUB_OUTPUT) || echo "EXISTS=false" >> $GITHUB_OUTPUT + ls -l dist + (test -f dist/*.sha256sum && echo "EXISTS=true" >> $GITHUB_OUTPUT) || echo "EXISTS=false" >> $GITHUB_OUTPUT - uses: actions/upload-artifact@v4 if: steps.check_file.outputs.EXISTS == 'true' with: name: node${{ matrix.target-node }}-linux-arm64 - path: root/pkg-fetch/dist/* + path: dist/* diff --git a/.github/workflows/build-linuxstatic.yml b/.github/workflows/build-linuxstatic.yml index 7c8721f5..2b50d1a8 100644 --- a/.github/workflows/build-linuxstatic.yml +++ b/.github/workflows/build-linuxstatic.yml @@ -42,19 +42,16 @@ jobs: context: . file: ./Dockerfile.alpine platforms: linux/amd64 - outputs: type=tar,dest=../out.tar + outputs: type=local, dest=dist - - name: Extract binaries from Docker image - run: | - tar xvf ../out.tar root/pkg-fetch/dist - - - name: Check if binary is compiled + - name: Check if binary is compiled, skip if download only id: check_file run: | - (test -f root/pkg-fetch/dist/*.sha256sum && echo "EXISTS=true" >> $GITHUB_OUTPUT) || echo "EXISTS=false" >> $GITHUB_OUTPUT + ls -l dist + (test -f dist/*.sha256sum && echo "EXISTS=true" >> $GITHUB_OUTPUT) || echo "EXISTS=false" >> $GITHUB_OUTPUT - uses: actions/upload-artifact@v4 if: steps.check_file.outputs.EXISTS == 'true' with: name: node${{ matrix.target-node }}-linuxstatic-${{ matrix.target-arch }} - path: root/pkg-fetch/dist/* + path: dist/* diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index f7f3e366..32e9d715 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -29,9 +29,10 @@ jobs: - run: yarn start --node-range node${{ matrix.target-node }} --output dist - - name: Check if binary is compiled + - name: Check if binary is compiled, skip if download only id: check_file run: | + ls -l dist (test -f dist/*.sha256sum && echo "EXISTS=true" >> $GITHUB_OUTPUT) || echo "EXISTS=false" >> $GITHUB_OUTPUT - uses: actions/upload-artifact@v3 diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index a5e95da8..a29ca914 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -28,7 +28,7 @@ jobs: - run: yarn start --node-range node${{ matrix.target-node }} --arch ${{ matrix.target-arch }} --output dist - - name: Check if binary is compiled + - name: Check if binary is compiled, skip if download only id: check_file run: | if (Test-Path -Path dist\\*.sha256sum -PathType Leaf) { echo ""EXISTS=true" >> $GITHUB_OUTPUT" } else { echo ""EXISTS=false" >> $GITHUB_OUTPUT" } diff --git a/Dockerfile.alpine b/Dockerfile.alpine index 1c423ae1..0c40f37c 100644 --- a/Dockerfile.alpine +++ b/Dockerfile.alpine @@ -1,7 +1,7 @@ ARG HOST_ARCH=x86_64 ARG TARGET_TRIPLE=aarch64-linux-musl -FROM muslcc/$HOST_ARCH:$TARGET_TRIPLE +FROM muslcc/$HOST_ARCH:$TARGET_TRIPLE AS build ARG PKG_FETCH_OPTION_a ARG PKG_FETCH_OPTION_n @@ -37,3 +37,6 @@ COPY . ./ RUN yarn install --ignore-engines RUN yarn start --arch $PKG_FETCH_OPTION_a --node-range $PKG_FETCH_OPTION_n --platform $PKG_FETCH_OPTION_p --output dist + +FROM scratch +COPY --from=build /root/pkg-fetch/dist / diff --git a/Dockerfile.linux b/Dockerfile.linux index 0c2407fe..6fde1b6a 100644 --- a/Dockerfile.linux +++ b/Dockerfile.linux @@ -1,4 +1,4 @@ -FROM oraclelinux:7 +FROM oraclelinux:7 AS build USER root:root WORKDIR /root/pkg-fetch/ @@ -27,3 +27,6 @@ RUN scl enable devtoolset-10 rh-python36 \ " \ yarn start --node-range $PKG_FETCH_OPTION_n --output dist \ " + +FROM scratch +COPY --from=build /root/pkg-fetch/dist / diff --git a/Dockerfile.linuxcross b/Dockerfile.linuxcross index 1443639c..8b2331fd 100644 --- a/Dockerfile.linuxcross +++ b/Dockerfile.linuxcross @@ -1,13 +1,15 @@ -FROM ubuntu:bionic +FROM ubuntu:bionic AS build USER root:root WORKDIR /root/pkg-fetch/ ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update -RUN apt-get install -y curl software-properties-common -RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash - -RUN apt-get install -y nodejs +RUN apt-get install -y curl software-properties-common ca-certificates gnupg + +# Install Node.js +RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash - && \ + apt-get install -y nodejs RUN apt-get install -y binutils g++-8 git make patch python3 python3-distutils @@ -40,3 +42,6 @@ ARG PKG_FETCH_OPTION_a ARG PKG_FETCH_OPTION_n RUN yarn start --arch $PKG_FETCH_OPTION_a --node-range $PKG_FETCH_OPTION_n --output dist + +FROM scratch +COPY --from=build /root/pkg-fetch/dist / diff --git a/patches/node.v18.19.0.cpp.patch b/patches/node.v18.19.0.cpp.patch index d2dd0a78..7eecccd7 100644 --- a/patches/node.v18.19.0.cpp.patch +++ b/patches/node.v18.19.0.cpp.patch @@ -413,7 +413,7 @@ index 08cb3f38e8..6c0d2761ab 100644 'conditions': [ + ['target_arch=="arm64"', { -+ 'cflags': ['-mbranch-protection=standard'], # Pointer authentication. ++ 'cflags': ['-msign-return-address=all'], # Pointer authentication. + }], ['OS in "aix os400"', { 'ldflags': [