mirror of
https://github.com/whyour/qinglong.git
synced 2026-11-02 06:58:52 +08:00
build: use sqlite3 1.1.3 ARM musl prebuilds (#3105)
This commit is contained in:
@@ -133,7 +133,7 @@ jobs:
|
|||||||
docker run --rm --network none --entrypoint node \
|
docker run --rm --network none --entrypoint node \
|
||||||
qinglong-readiness:${{ matrix.image }} \
|
qinglong-readiness:${{ matrix.image }} \
|
||||||
-e 'const assert=require("node:assert/strict"); const {createRequire}=require("node:module"); for(const [name,want] of Object.entries({"@grpc/grpc-js":"1.14.5",compression:"1.8.2",multer:"2.4.0",sequelize:"6.37.8"}))assert.equal(require(name+"/package.json").version,want); const expressRequire=createRequire(require.resolve("express")); assert.equal(expressRequire("proxy-addr/package.json").version,"2.0.8"); const sockRequire=createRequire(require.resolve("sockjs")); assert.equal(sockRequire("websocket-driver/package.json").version,"0.7.5"); require("sqlite3"); require("nodemailer"); require("undici"); console.log("Minimal production patches and runtime imports verified")'
|
-e 'const assert=require("node:assert/strict"); const {createRequire}=require("node:module"); for(const [name,want] of Object.entries({"@grpc/grpc-js":"1.14.5",compression:"1.8.2",multer:"2.4.0",sequelize:"6.37.8"}))assert.equal(require(name+"/package.json").version,want); const expressRequire=createRequire(require.resolve("express")); assert.equal(expressRequire("proxy-addr/package.json").version,"2.0.8"); const sockRequire=createRequire(require.resolve("sockjs")); assert.equal(sockRequire("websocket-driver/package.json").version,"0.7.5"); require("sqlite3"); require("nodemailer"); require("undici"); console.log("Minimal production patches and runtime imports verified")'
|
||||||
- name: Export ARMv6 image layers for Node regression checks
|
- name: Load ARMv6 image for SQLite and Node regression checks
|
||||||
if: startsWith(matrix.image, 'alpine')
|
if: startsWith(matrix.image, 'alpine')
|
||||||
uses: docker/build-push-action@v7
|
uses: docker/build-push-action@v7
|
||||||
with:
|
with:
|
||||||
@@ -144,14 +144,23 @@ jobs:
|
|||||||
QL_URL=${{ steps.source.outputs.url }}
|
QL_URL=${{ steps.source.outputs.url }}
|
||||||
QL_BRANCH=${{ steps.source.outputs.branch }}
|
QL_BRANCH=${{ steps.source.outputs.branch }}
|
||||||
SOURCE_COMMIT=${{ steps.source.outputs.sha }}
|
SOURCE_COMMIT=${{ steps.source.outputs.sha }}
|
||||||
outputs: type=docker,dest=${{ runner.temp }}/node-layers-arm.tar
|
tags: qinglong-readiness:${{ matrix.image }}-armv6
|
||||||
|
load: true
|
||||||
push: false
|
push: false
|
||||||
provenance: false
|
provenance: false
|
||||||
sbom: false
|
sbom: false
|
||||||
|
- name: Verify ARMv6 SQLite on an ARM1176 CPU without networking
|
||||||
|
if: startsWith(matrix.image, 'alpine')
|
||||||
|
run: |
|
||||||
|
docker run --rm --network none --platform linux/arm/v6 \
|
||||||
|
-e QEMU_CPU=arm1176 --entrypoint node \
|
||||||
|
qinglong-readiness:${{ matrix.image }}-armv6 --jitless \
|
||||||
|
-e 'const assert=require("node:assert/strict"); const sqlite3=require("sqlite3"); const db=new sqlite3.Database(":memory:"); db.get("SELECT 42 AS n",(error,row)=>{assert.ifError(error); assert.equal(row.n,42); db.close()});'
|
||||||
- name: Check Node binaries in every serialized image layer
|
- name: Check Node binaries in every serialized image layer
|
||||||
if: startsWith(matrix.image, 'alpine')
|
if: startsWith(matrix.image, 'alpine')
|
||||||
run: |
|
run: |
|
||||||
docker save qinglong-readiness:${{ matrix.image }} -o "$RUNNER_TEMP/node-layers-amd64.tar"
|
docker save qinglong-readiness:${{ matrix.image }} -o "$RUNNER_TEMP/node-layers-amd64.tar"
|
||||||
|
docker save qinglong-readiness:${{ matrix.image }}-armv6 -o "$RUNNER_TEMP/node-layers-arm.tar"
|
||||||
python3 scripts/verify-image-node-layers.py "$RUNNER_TEMP/node-layers-amd64.tar" amd64
|
python3 scripts/verify-image-node-layers.py "$RUNNER_TEMP/node-layers-amd64.tar" amd64
|
||||||
python3 scripts/verify-image-node-layers.py "$RUNNER_TEMP/node-layers-arm.tar" arm
|
python3 scripts/verify-image-node-layers.py "$RUNNER_TEMP/node-layers-arm.tar" arm
|
||||||
rm "$RUNNER_TEMP/node-layers-amd64.tar" "$RUNNER_TEMP/node-layers-arm.tar"
|
rm "$RUNNER_TEMP/node-layers-amd64.tar" "$RUNNER_TEMP/node-layers-arm.tar"
|
||||||
|
|||||||
+9
-2
@@ -3,6 +3,7 @@
|
|||||||
FROM --platform=$BUILDPLATFORM node:18-alpine3.18 AS builder
|
FROM --platform=$BUILDPLATFORM node:18-alpine3.18 AS builder
|
||||||
|
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
|
ARG TARGETVARIANT
|
||||||
ENV NPM_CONFIG_PREFIX=/opt/node-global
|
ENV NPM_CONFIG_PREFIX=/opt/node-global
|
||||||
ENV PATH=/opt/node-global/bin:${PATH}
|
ENV PATH=/opt/node-global/bin:${PATH}
|
||||||
|
|
||||||
@@ -17,10 +18,16 @@ RUN set -x \
|
|||||||
ppc64le) NODE_ARCH=ppc64 ;; \
|
ppc64le) NODE_ARCH=ppc64 ;; \
|
||||||
*) NODE_ARCH="${TARGETARCH}" ;; \
|
*) NODE_ARCH="${TARGETARCH}" ;; \
|
||||||
esac \
|
esac \
|
||||||
|
&& case "${TARGETARCH}/${TARGETVARIANT:-}" in \
|
||||||
|
arm/v6) NODE_LIBC=musl-armv6 ;; \
|
||||||
|
arm/v7) NODE_LIBC=musl-armv7 ;; \
|
||||||
|
arm/*) echo "Unsupported ARM variant: ${TARGETVARIANT:-unknown}" >&2; exit 1 ;; \
|
||||||
|
*) NODE_LIBC=musl ;; \
|
||||||
|
esac \
|
||||||
&& npm_config_target_platform=linux \
|
&& npm_config_target_platform=linux \
|
||||||
npm_config_target_arch="${NODE_ARCH}" \
|
npm_config_target_arch="${NODE_ARCH}" \
|
||||||
npm_config_target_libc=musl \
|
npm_config_target_libc="${NODE_LIBC}" \
|
||||||
pnpm install --prod --frozen-lockfile
|
pnpm install --prod --frozen-lockfile --side-effects-cache=false
|
||||||
|
|
||||||
# Pin amd64 to upstream's musl runtime after native URL parser crashes with APK Node.
|
# Pin amd64 to upstream's musl runtime after native URL parser crashes with APK Node.
|
||||||
FROM --platform=linux/amd64 node:24.18.1-alpine3.24@sha256:f70403e87646dc51b45295f4b8b70cdad0b63d2297c4c9899119b03f7af7a6b3 AS node-runtime-amd64
|
FROM --platform=linux/amd64 node:24.18.1-alpine3.24@sha256:f70403e87646dc51b45295f4b8b70cdad0b63d2297c4c9899119b03f7af7a6b3 AS node-runtime-amd64
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
FROM --platform=$BUILDPLATFORM node:18-alpine3.18 AS builder
|
FROM --platform=$BUILDPLATFORM node:18-alpine3.18 AS builder
|
||||||
|
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
|
ARG TARGETVARIANT
|
||||||
ENV NPM_CONFIG_PREFIX=/opt/node-global
|
ENV NPM_CONFIG_PREFIX=/opt/node-global
|
||||||
ENV PATH=/opt/node-global/bin:${PATH}
|
ENV PATH=/opt/node-global/bin:${PATH}
|
||||||
|
|
||||||
@@ -17,10 +18,16 @@ RUN set -x \
|
|||||||
ppc64le) NODE_ARCH=ppc64 ;; \
|
ppc64le) NODE_ARCH=ppc64 ;; \
|
||||||
*) NODE_ARCH="${TARGETARCH}" ;; \
|
*) NODE_ARCH="${TARGETARCH}" ;; \
|
||||||
esac \
|
esac \
|
||||||
|
&& case "${TARGETARCH}/${TARGETVARIANT:-}" in \
|
||||||
|
arm/v6) NODE_LIBC=musl-armv6 ;; \
|
||||||
|
arm/v7) NODE_LIBC=musl-armv7 ;; \
|
||||||
|
arm/*) echo "Unsupported ARM variant: ${TARGETVARIANT:-unknown}" >&2; exit 1 ;; \
|
||||||
|
*) NODE_LIBC=musl ;; \
|
||||||
|
esac \
|
||||||
&& npm_config_target_platform=linux \
|
&& npm_config_target_platform=linux \
|
||||||
npm_config_target_arch="${NODE_ARCH}" \
|
npm_config_target_arch="${NODE_ARCH}" \
|
||||||
npm_config_target_libc=musl \
|
npm_config_target_libc="${NODE_LIBC}" \
|
||||||
pnpm install --prod --frozen-lockfile
|
pnpm install --prod --frozen-lockfile --side-effects-cache=false
|
||||||
|
|
||||||
# Pin amd64 to upstream's musl runtime after native URL parser crashes with APK Node.
|
# Pin amd64 to upstream's musl runtime after native URL parser crashes with APK Node.
|
||||||
FROM --platform=linux/amd64 node:24.18.1-alpine3.24@sha256:f70403e87646dc51b45295f4b8b70cdad0b63d2297c4c9899119b03f7af7a6b3 AS node-runtime-amd64
|
FROM --platform=linux/amd64 node:24.18.1-alpine3.24@sha256:f70403e87646dc51b45295f4b8b70cdad0b63d2297c4c9899119b03f7af7a6b3 AS node-runtime-amd64
|
||||||
|
|||||||
@@ -6,18 +6,6 @@ ENV QL_BUNDLE_BASE_IMAGE=${BASE_IMAGE}
|
|||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
ARG TARGETVARIANT
|
ARG TARGETVARIANT
|
||||||
USER root
|
USER root
|
||||||
# The generic "arm" sqlite release is ARMv7. ARMv6 must compile its own addon.
|
|
||||||
RUN ulimit -c 0; if [ "$TARGETARCH/$TARGETVARIANT" = arm/v6 ]; then \
|
|
||||||
apk add --no-cache --virtual .ql-bundle-build build-base binutils python3 nodejs-dev && \
|
|
||||||
cd "$(readlink -f /ql/node_modules/sqlite3)" && \
|
|
||||||
CFLAGS='-march=armv6 -mfpu=vfp -mfloat-abi=hard' \
|
|
||||||
CXXFLAGS='-march=armv6 -mfpu=vfp -mfloat-abi=hard' \
|
|
||||||
npm_config_nodedir=/usr npm_config_build_from_source=true QEMU_CPU=arm1176 \
|
|
||||||
node -e 'require("node:child_process").execFileSync(process.execPath,[require.resolve("@mapbox/node-pre-gyp/bin/node-pre-gyp"),"rebuild","--napi_build_version=6"],{stdio:"inherit"})' && \
|
|
||||||
readelf -A lib/binding/napi-v6-linux-arm/node_sqlite3.node | grep -E 'Tag_CPU_arch: v6($|K)' && \
|
|
||||||
rm -rf build && \
|
|
||||||
apk del .ql-bundle-build; \
|
|
||||||
fi
|
|
||||||
RUN ulimit -c 0; if [ "$TARGETARCH/$TARGETVARIANT" = arm/v6 ]; then \
|
RUN ulimit -c 0; if [ "$TARGETARCH/$TARGETVARIANT" = arm/v6 ]; then \
|
||||||
export QEMU_CPU=arm1176; \
|
export QEMU_CPU=arm1176; \
|
||||||
node --jitless /ql/scripts/build-upgrade-bundle.cjs /ql /out && \
|
node --jitless /ql/scripts/build-upgrade-bundle.cjs /ql /out && \
|
||||||
|
|||||||
+2
-2
@@ -111,7 +111,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"overrides": {
|
"overrides": {
|
||||||
"sqlite3": "npm:@whyour/sqlite3@1.1.2",
|
"sqlite3": "npm:@whyour/sqlite3@1.1.3",
|
||||||
"@codemirror/state": "6.5.4",
|
"@codemirror/state": "6.5.4",
|
||||||
"@codemirror/view": "6.39.16",
|
"@codemirror/view": "6.39.16",
|
||||||
"proxy-addr": "2.0.8",
|
"proxy-addr": "2.0.8",
|
||||||
@@ -159,7 +159,7 @@
|
|||||||
"request-ip": "3.3.0",
|
"request-ip": "3.3.0",
|
||||||
"sequelize": "6.37.8",
|
"sequelize": "6.37.8",
|
||||||
"sockjs": "^0.3.24",
|
"sockjs": "^0.3.24",
|
||||||
"sqlite3": "npm:@whyour/sqlite3@1.1.2",
|
"sqlite3": "npm:@whyour/sqlite3@1.1.3",
|
||||||
"toad-scheduler": "^3.0.1",
|
"toad-scheduler": "^3.0.1",
|
||||||
"typedi": "^0.10.0",
|
"typedi": "^0.10.0",
|
||||||
"undici": "^7.9.0",
|
"undici": "^7.9.0",
|
||||||
|
|||||||
Generated
+10
-10
@@ -1,7 +1,7 @@
|
|||||||
lockfileVersion: '6.0'
|
lockfileVersion: '6.0'
|
||||||
|
|
||||||
overrides:
|
overrides:
|
||||||
sqlite3: npm:@whyour/sqlite3@1.1.2
|
sqlite3: npm:@whyour/sqlite3@1.1.3
|
||||||
'@codemirror/state': 6.5.4
|
'@codemirror/state': 6.5.4
|
||||||
'@codemirror/view': 6.39.16
|
'@codemirror/view': 6.39.16
|
||||||
proxy-addr: 2.0.8
|
proxy-addr: 2.0.8
|
||||||
@@ -120,13 +120,13 @@ dependencies:
|
|||||||
version: 3.3.0
|
version: 3.3.0
|
||||||
sequelize:
|
sequelize:
|
||||||
specifier: 6.37.8
|
specifier: 6.37.8
|
||||||
version: 6.37.8(@whyour/sqlite3@1.1.2)
|
version: 6.37.8(@whyour/sqlite3@1.1.3)
|
||||||
sockjs:
|
sockjs:
|
||||||
specifier: ^0.3.24
|
specifier: ^0.3.24
|
||||||
version: 0.3.24
|
version: 0.3.24
|
||||||
sqlite3:
|
sqlite3:
|
||||||
specifier: npm:@whyour/sqlite3@1.1.2
|
specifier: npm:@whyour/sqlite3@1.1.3
|
||||||
version: /@whyour/sqlite3@1.1.2
|
version: /@whyour/sqlite3@1.1.3
|
||||||
tar:
|
tar:
|
||||||
specifier: 7.5.20
|
specifier: 7.5.20
|
||||||
version: 7.5.20
|
version: 7.5.20
|
||||||
@@ -3193,7 +3193,7 @@ packages:
|
|||||||
resolution: {integrity: sha512-Ngs9jhElXN7efS9WvvCC/p6rXMbihna8eNLVBc421Zf+VcFd+pR4DOcS6yA9V22EKtAy4DEj7LtvEEIm0bb80A==}
|
resolution: {integrity: sha512-Ngs9jhElXN7efS9WvvCC/p6rXMbihna8eNLVBc421Zf+VcFd+pR4DOcS6yA9V22EKtAy4DEj7LtvEEIm0bb80A==}
|
||||||
engines: {node: '>= 18'}
|
engines: {node: '>= 18'}
|
||||||
dependencies:
|
dependencies:
|
||||||
sqlite3: /@whyour/sqlite3@1.1.2
|
sqlite3: /@whyour/sqlite3@1.1.3
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- encoding
|
- encoding
|
||||||
- supports-color
|
- supports-color
|
||||||
@@ -5611,14 +5611,15 @@ packages:
|
|||||||
- supports-color
|
- supports-color
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@whyour/sqlite3@1.1.2:
|
/@whyour/sqlite3@1.1.3:
|
||||||
resolution: {integrity: sha512-OY24/OJMqLHIGolo4GCFW4lrJKAoOB+ZqERXb7u7DKZQz7QR3f0GALE99BZWQBSZEVVZ/StVeAb2fCkMfTtuDQ==}
|
resolution: {integrity: sha512-VeiureU2gq11OMeSMWlpckNfbY5QF+V0KEpRi1Zqh/s5GEPgCazt06xIg528tPAwK0MS9KCUEyLb+dKDIIFoEg==}
|
||||||
requiresBuild: true
|
requiresBuild: true
|
||||||
peerDependenciesMeta:
|
peerDependenciesMeta:
|
||||||
node-gyp:
|
node-gyp:
|
||||||
optional: true
|
optional: true
|
||||||
dependencies:
|
dependencies:
|
||||||
'@mapbox/node-pre-gyp': 1.0.11
|
'@mapbox/node-pre-gyp': 1.0.11
|
||||||
|
detect-libc: 1.0.3
|
||||||
node-addon-api: 4.3.0
|
node-addon-api: 4.3.0
|
||||||
tar: 6.2.1
|
tar: 6.2.1
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
@@ -7601,7 +7602,6 @@ packages:
|
|||||||
resolution: {integrity: sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==}
|
resolution: {integrity: sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==}
|
||||||
engines: {node: '>=0.10'}
|
engines: {node: '>=0.10'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
dev: true
|
|
||||||
|
|
||||||
/detect-libc@2.1.2:
|
/detect-libc@2.1.2:
|
||||||
resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==}
|
resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==}
|
||||||
@@ -13903,7 +13903,7 @@ packages:
|
|||||||
engines: {node: '>= 10.0.0'}
|
engines: {node: '>= 10.0.0'}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/sequelize@6.37.8(@whyour/sqlite3@1.1.2):
|
/sequelize@6.37.8(@whyour/sqlite3@1.1.3):
|
||||||
resolution: {integrity: sha512-HJ0IQFqcTsTiqbEgiuioYFMSD00TP6Cz7zoTti+zVVBwVe9fEhev9cH6WnM3XU31+ABS356durAb99ZuOthnKw==}
|
resolution: {integrity: sha512-HJ0IQFqcTsTiqbEgiuioYFMSD00TP6Cz7zoTti+zVVBwVe9fEhev9cH6WnM3XU31+ABS356durAb99ZuOthnKw==}
|
||||||
engines: {node: '>=10.0.0'}
|
engines: {node: '>=10.0.0'}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
@@ -13948,7 +13948,7 @@ packages:
|
|||||||
retry-as-promised: 7.0.4
|
retry-as-promised: 7.0.4
|
||||||
semver: 7.7.4
|
semver: 7.7.4
|
||||||
sequelize-pool: 7.1.0
|
sequelize-pool: 7.1.0
|
||||||
sqlite3: /@whyour/sqlite3@1.1.2
|
sqlite3: /@whyour/sqlite3@1.1.3
|
||||||
toposort-class: 1.0.1
|
toposort-class: 1.0.1
|
||||||
uuid: 8.3.2
|
uuid: 8.3.2
|
||||||
validator: 13.12.0
|
validator: 13.12.0
|
||||||
|
|||||||
Reference in New Issue
Block a user