Skip to content

Commit

Permalink
fix: build issues (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsLando authored Feb 2, 2024
1 parent 3f7d742 commit 59a2c69
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 41 deletions.
13 changes: 5 additions & 8 deletions .github/workflows/build-alpine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/*
28 changes: 12 additions & 16 deletions .github/workflows/build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,27 @@ jobs:
uses: docker/setup-buildx-action@v3

- name: Build
id: build
uses: docker/build-push-action@v5
with:
build-args: |
PKG_FETCH_OPTION_n=node${{ matrix.target-node }}
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
Expand All @@ -59,6 +57,7 @@ jobs:
uses: docker/setup-buildx-action@v3

- name: Build
id: build
uses: docker/build-push-action@v5
with:
build-args: |
Expand All @@ -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/*
13 changes: 5 additions & 8 deletions .github/workflows/build-linuxstatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/*
3 changes: 2 additions & 1 deletion .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
5 changes: 4 additions & 1 deletion Dockerfile.alpine
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 /
5 changes: 4 additions & 1 deletion Dockerfile.linux
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM oraclelinux:7
FROM oraclelinux:7 AS build

USER root:root
WORKDIR /root/pkg-fetch/
Expand Down Expand Up @@ -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 /
13 changes: 9 additions & 4 deletions Dockerfile.linuxcross
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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 /
2 changes: 1 addition & 1 deletion patches/node.v18.19.0.cpp.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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': [
Expand Down

0 comments on commit 59a2c69

Please sign in to comment.