From 29844995288591e542a2d11c65040ec9a9b6f64e Mon Sep 17 00:00:00 2001 From: DanSnow Date: Sun, 26 Jun 2022 12:13:13 +0800 Subject: [PATCH 1/2] feat: add linux-arm64-lts, linux-arm64-musl --- .github/workflows/release.yml | 2 ++ .github/workflows/test.yml | 2 ++ linux-arm64-lts/Dockerfile | 43 +++++++++++++++++++++++++++++++++++ linux-arm64-musl/Dockerfile | 43 +++++++++++++++++++++++++++++++++++ 4 files changed, 90 insertions(+) create mode 100644 linux-arm64-lts/Dockerfile create mode 100644 linux-arm64-musl/Dockerfile diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3cdd098..05fad17 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,6 +19,8 @@ jobs: - linux-armv6 - linux-armv7 - linux-arm64 + - linux-arm64-lts + - linux-arm64-musl steps: - name: Checkout uses: actions/checkout@v3 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 931b512..b6a79a6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,6 +20,8 @@ jobs: - linux-armv6 - linux-armv7 - linux-arm64 + - linux-arm64-lts + - linux-arm64-musl steps: - name: Checkout uses: actions/checkout@v3 diff --git a/linux-arm64-lts/Dockerfile b/linux-arm64-lts/Dockerfile new file mode 100644 index 0000000..b805de5 --- /dev/null +++ b/linux-arm64-lts/Dockerfile @@ -0,0 +1,43 @@ +FROM dockcross/linux-arm64-lts + +RUN groupadd --gid 1000 node && useradd --uid 1000 --gid node --shell /bin/bash --create-home node && \ + groupadd --gid 2000 travis && useradd --uid 2000 --gid travis --shell /bin/bash --create-home travis && \ + apt-get -y update && \ + apt-get -y --no-install-recommends install git curl gnupg apt-transport-https && \ + echo Package: nodejs >> /etc/apt/preferences.d/preferences && \ + echo Pin: origin deb.nodesource.com >> /etc/apt/preferences.d/preferences && \ + echo Pin-Priority: 1000 >> /etc/apt/preferences.d/preferences && \ + curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - && \ + apt-get -y install nodejs && \ + npm -v && \ + test -f ${CROSS_ROOT}/bin/${CROSS_TRIPLE}-strip && \ + rm -rf /var/lib/apt/lists/* + +USER node +ENV HOME /home/node + +ENV PREBUILD_STRIP_BIN ${CROSS_ROOT}/bin/${CROSS_TRIPLE}-strip +ENV PREBUILD_ARCH arm64 +ENV PREBUILD_ARMV 8 +ENV PREBUILD_PLATFORM linux + +# TODO: These are for backwards compat. Remove once we have versioning. +ENV STRIP ${PREBUILD_STRIP_BIN} +ENV ARCH ${PREBUILD_ARCH} +ENV ARM_VERSION ${PREBUILD_ARMV} +ENV TARGET_PLATFORM ${PREBUILD_PLATFORM} + +# Disable npm update check +ENV NO_UPDATE_NOTIFIER true +ENV npm_config_update_notifier false + +# Set inherited dockcross labels to empty values. +# Labels can't be deleted (https://github.com/moby/moby/issues/3465) +LABEL org.label-schema.build-date= +LABEL org.label-schema.name= +LABEL org.label-schema.schema-version= +LABEL org.label-schema.vcs-ref= +LABEL org.label-schema.vcs-url= +LABEL org.label-schema.version= + +WORKDIR /app diff --git a/linux-arm64-musl/Dockerfile b/linux-arm64-musl/Dockerfile new file mode 100644 index 0000000..0d5d406 --- /dev/null +++ b/linux-arm64-musl/Dockerfile @@ -0,0 +1,43 @@ +FROM dockcross/linux-arm64-musl + +RUN groupadd --gid 1000 node && useradd --uid 1000 --gid node --shell /bin/bash --create-home node && \ + groupadd --gid 2000 travis && useradd --uid 2000 --gid travis --shell /bin/bash --create-home travis && \ + apt-get -y update && \ + apt-get -y --no-install-recommends install git curl gnupg apt-transport-https && \ + echo Package: nodejs >> /etc/apt/preferences.d/preferences && \ + echo Pin: origin deb.nodesource.com >> /etc/apt/preferences.d/preferences && \ + echo Pin-Priority: 1000 >> /etc/apt/preferences.d/preferences && \ + curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - && \ + apt-get -y install nodejs && \ + npm -v && \ + test -f ${CROSS_ROOT}/bin/${CROSS_TRIPLE}-strip && \ + rm -rf /var/lib/apt/lists/* + +USER node +ENV HOME /home/node + +ENV PREBUILD_STRIP_BIN ${CROSS_ROOT}/bin/${CROSS_TRIPLE}-strip +ENV PREBUILD_ARCH arm64 +ENV PREBUILD_ARMV 8 +ENV PREBUILD_PLATFORM linux + +# TODO: These are for backwards compat. Remove once we have versioning. +ENV STRIP ${PREBUILD_STRIP_BIN} +ENV ARCH ${PREBUILD_ARCH} +ENV ARM_VERSION ${PREBUILD_ARMV} +ENV TARGET_PLATFORM ${PREBUILD_PLATFORM} + +# Disable npm update check +ENV NO_UPDATE_NOTIFIER true +ENV npm_config_update_notifier false + +# Set inherited dockcross labels to empty values. +# Labels can't be deleted (https://github.com/moby/moby/issues/3465) +LABEL org.label-schema.build-date= +LABEL org.label-schema.name= +LABEL org.label-schema.schema-version= +LABEL org.label-schema.vcs-ref= +LABEL org.label-schema.vcs-url= +LABEL org.label-schema.version= + +WORKDIR /app From 99bd7f882b17b4741328cb620527e3b8b2cd58c3 Mon Sep 17 00:00:00 2001 From: DanSnow Date: Mon, 27 Jun 2022 07:59:11 +0800 Subject: [PATCH 2/2] doc: add new image to readme --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index f7e9394..aae87c7 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,14 @@ Cross-compile for Linux ARM. This image thinly wraps a [`dockcross`](https://git Cross-compile for Linux ARM. This image thinly wraps a [`dockcross`](https://github.com/dockcross/dockcross) image. Preconfigures `prebuildify` to [tag](https://github.com/prebuild/prebuildify#options) prebuilds with the armv version (8). +### [`linux-arm64-lts`](https://github.com/orgs/prebuild/packages/container/package/linux-arm64-lts) + +Cross-compile for Linux ARM. This image uses an old version of glibc (glibc 2.27) for compatibility. This image thinly wraps a [`dockcross`](https://github.com/dockcross/dockcross) image. Preconfigures `prebuildify` to [tag](https://github.com/prebuild/prebuildify#options) prebuilds with the armv version (8). + +### [`linux-arm64-musl`](https://github.com/orgs/prebuild/packages/container/package/linux-arm64-musl) + +Cross-compile for Linux ARM. This image uses musl instead of glibc for Alpine linux. This image thinly wraps a [`dockcross`](https://github.com/dockcross/dockcross) image. Preconfigures `prebuildify` to [tag](https://github.com/prebuild/prebuildify#options) prebuilds with the armv version (8). + ### [`android-armv7`](https://github.com/orgs/prebuild/packages/container/package/android-armv7) Cross-compile for Android ARM. This image thinly wraps a [`dockcross`](https://github.com/dockcross/dockcross) image. Preconfigures `prebuildify` to [tag](https://github.com/prebuild/prebuildify#options) prebuilds with the armv version (7).