mirror of
https://github.com/whyour/qinglong.git
synced 2026-10-18 18:33:06 +08:00
31 lines
1.5 KiB
Docker
31 lines
1.5 KiB
Docker
# The image digest is supplied by the same workflow run, never a rolling tag.
|
|
ARG BASE_IMAGE
|
|
FROM ${BASE_IMAGE} AS bundle
|
|
ARG BASE_IMAGE
|
|
ENV QL_BUNDLE_BASE_IMAGE=${BASE_IMAGE}
|
|
ARG TARGETARCH
|
|
ARG TARGETVARIANT
|
|
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 \
|
|
export QEMU_CPU=arm1176; \
|
|
node --jitless /ql/scripts/build-upgrade-bundle.cjs /ql /out && \
|
|
for archive in /out/*.tar.gz; do \
|
|
node /ql/shell/install-bundle.cjs --root /tmp/ql-bundle-offline-smoke --file "$archive" --install && \
|
|
rm -rf /tmp/ql-bundle-offline-smoke || exit 1; \
|
|
done; \
|
|
else node /ql/scripts/build-upgrade-bundle.cjs /ql /out; fi
|
|
FROM scratch
|
|
COPY --from=bundle /out/ /
|