Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error trying to build multi-arch image for 20.10.0 for alpine:3.18 (linux/arm64/v8, linux/amd64) #2001

Open
pkyeck opened this issue Dec 1, 2023 · 2 comments

Comments

@pkyeck
Copy link

pkyeck commented Dec 1, 2023

Environment

  • Platform: MacOS Ventura 13.6
  • Docker Version: Docker version 24.0.6, build ed223bc
  • Node.js Version: node 16.17.0
  • Image Tag: 20.10.0-alpine3.18

Expected Behavior

I'm trying to build a multi-arch image from this Dockerfile (https://github.com/nodejs/docker-node/blob/main/20/alpine3.18/Dockerfile) with the following command:

docker buildx build --platform linux/arm64/v8,linux/amd64 -t node:20.10.0-multi -f Dockerfile .

And I'm expecting a working image after the build is done.

Current Behavior

But I get an error saying:

... 

939.0 g++: warning: switch '-msign-return-address=all' is no longer supported
940.4 g++: warning: switch '-msign-return-address=all' is no longer supported
940.4   CXX(target) /node-v20.10.0/out/Release/obj.target/v8_initializers/gen/torque-generated/src/builtins/array-find-tq-csa.o
941.4   CXX(target) /node-v20.10.0/out/Release/obj.target/v8_initializers/gen/torque-generated/src/builtins/array-findindex-tq-csa.o
941.4 g++: warning: switch '-msign-return-address=all' is no longer supported
950.6 g++: fatal error: Killed signal terminated program cc1plus
950.6 compilation terminated.
950.6 make[1]: *** [tools/v8_gypfiles/v8_initializers.target.mk:437: /node-v20.10.0/out/Release/obj.target/v8_initializers/deps/v8/src/codegen/code-stub-assembler.o] Error 1
950.6 make[1]: *** Waiting for unfinished jobs....
956.6 rm 32d09c94e8f37b857b53dc695ccb58887711d7b6.intermediate fa58456d568e892fc427e16daf26a3b164825782.intermediate 336d02fdf26292735c35c58219b134814c2a4bb3.intermediate
956.6 make: *** [Makefile:134: node] Error 2
------
WARNING: No output specified with docker-container driver. Build result will only remain in the build cache. To push result image into registry use --push or to load image into docker use --load
Dockerfile-node-alpine-318:5
--------------------
   4 |     
   5 | >>> RUN addgroup -g 1000 node \
   6 | >>>     && adduser -u 1000 -G node -s /bin/sh -D node \
   7 | >>>     && apk add --no-cache \
   8 | >>>         libstdc++ \
   9 | >>>     && apk add --no-cache --virtual .build-deps \
  10 | >>>         curl \
  11 | >>>     && ARCH= OPENSSL_ARCH='linux*' && alpineArch="$(apk --print-arch)" \
  12 | >>>       && case "${alpineArch##*-}" in \
  13 | >>>         x86_64) ARCH='x64' CHECKSUM="2c654df3615ed02dc1994f58bdbc6b5cd37fdc01f695188388326f12c753f01b" OPENSSL_ARCH=linux-x86_64;; \
  14 | >>>         x86) OPENSSL_ARCH=linux-elf;; \
  15 | >>>         aarch64) OPENSSL_ARCH=linux-aarch64;; \
  16 | >>>         arm*) OPENSSL_ARCH=linux-armv4;; \
  17 | >>>         ppc64le) OPENSSL_ARCH=linux-ppc64le;; \
  18 | >>>         s390x) OPENSSL_ARCH=linux-s390x;; \
  19 | >>>         *) ;; \
  20 | >>>       esac \
  21 | >>>   && if [ -n "${CHECKSUM}" ]; then \
  22 | >>>     set -eu; \
  23 | >>>     curl -fsSLO --compressed "https://unofficial-builds.nodejs.org/download/release/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz"; \
  24 | >>>     echo "$CHECKSUM  node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz" | sha256sum -c - \
  25 | >>>       && tar -xJf "node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz" -C /usr/local --strip-components=1 --no-same-owner \
  26 | >>>       && ln -s /usr/local/bin/node /usr/local/bin/nodejs; \
  27 | >>>   else \
  28 | >>>     echo "Building from source" \
  29 | >>>     # backup build
  30 | >>>     && apk add --no-cache --virtual .build-deps-full \
  31 | >>>         binutils-gold \
  32 | >>>         g++ \
  33 | >>>         gcc \
  34 | >>>         gnupg \
  35 | >>>         libgcc \
  36 | >>>         linux-headers \
  37 | >>>         make \
  38 | >>>         python3 \
  39 | >>>     # use pre-existing gpg directory, see https://github.com/nodejs/docker-node/pull/1895#issuecomment-1550389150
  40 | >>>     && export GNUPGHOME="$(mktemp -d)" \
  41 | >>>     # gpg keys listed at https://github.com/nodejs/node#release-keys
  42 | >>>     && for key in \
  43 | >>>       4ED778F539E3634C779C87C6D7062848A1AB005C \
  44 | >>>       141F07595B7B3FFE74309A937405533BE57C7D57 \
  45 | >>>       74F12602B6F1C4E913FAA37AD3A89613643B6201 \
  46 | >>>       DD792F5973C6DE52C432CBDAC77ABFA00DDBF2B7 \
  47 | >>>       61FC681DFB92A079F1685E77973F295594EC4689 \
  48 | >>>       8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 \
  49 | >>>       C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \
  50 | >>>       890C08DB8579162FEE0DF9DB8BEAB4DFCF555EF4 \
  51 | >>>       C82FA3AE1CBEDC6BE46B9360C43CEC45C17AB93C \
  52 | >>>       108F52B48DB57BB0CC439B2997B01419BD92F80A \
  53 | >>>       A363A499291CBBC940DD62E41F10027AF002F8B0 \
  54 | >>>     ; do \
  55 | >>>       gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" || \
  56 | >>>       gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" ; \
  57 | >>>     done \
  58 | >>>     && curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION.tar.xz" \
  59 | >>>     && curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \
  60 | >>>     && gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \
  61 | >>>     && gpgconf --kill all \
  62 | >>>     && rm -rf "$GNUPGHOME" \
  63 | >>>     && grep " node-v$NODE_VERSION.tar.xz\$" SHASUMS256.txt | sha256sum -c - \
  64 | >>>     && tar -xf "node-v$NODE_VERSION.tar.xz" \
  65 | >>>     && cd "node-v$NODE_VERSION" \
  66 | >>>     && ./configure \
  67 | >>>     && make -j$(getconf _NPROCESSORS_ONLN) V= \
  68 | >>>     && make install \
  69 | >>>     && apk del .build-deps-full \
  70 | >>>     && cd .. \
  71 | >>>     && rm -Rf "node-v$NODE_VERSION" \
  72 | >>>     && rm "node-v$NODE_VERSION.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt; \
  73 | >>>   fi \
  74 | >>>   && rm -f "node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz" \
  75 | >>>   # Remove unused OpenSSL headers to save ~34MB. See this NodeJS issue: https://github.com/nodejs/node/issues/46451
  76 | >>>   && find /usr/local/include/node/openssl/archs -mindepth 1 -maxdepth 1 ! -name "$OPENSSL_ARCH" -exec rm -rf {} \; \
  77 | >>>   && apk del .build-deps \
  78 | >>>   # smoke tests
  79 | >>>   && node --version \
  80 | >>>   && npm --version
  81 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c addgroup -g 1000 node     && adduser -u 1000 -G node -s /bin/sh -D node     && apk add --no-cache         libstdc++     && apk add --no-cache --virtual .build-deps         curl     && ARCH= OPENSSL_ARCH='linux*' && alpineArch=\"$(apk --print-arch)\"       && case \"${alpineArch##*-}\" in         x86_64) ARCH='x64' CHECKSUM=\"2c654df3615ed02dc1994f58bdbc6b5cd37fdc01f695188388326f12c753f01b\" OPENSSL_ARCH=linux-x86_64;;         x86) OPENSSL_ARCH=linux-elf;;         aarch64) OPENSSL_ARCH=linux-aarch64;;         arm*) OPENSSL_ARCH=linux-armv4;;         ppc64le) OPENSSL_ARCH=linux-ppc64le;;         s390x) OPENSSL_ARCH=linux-s390x;;         *) ;;       esac   && if [ -n \"${CHECKSUM}\" ]; then     set -eu;     curl -fsSLO --compressed \"https://unofficial-builds.nodejs.org/download/release/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz\";     echo \"$CHECKSUM  node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz\" | sha256sum -c -       && tar -xJf \"node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz\" -C /usr/local --strip-components=1 --no-same-owner       && ln -s /usr/local/bin/node /usr/local/bin/nodejs;   else     echo \"Building from source\"     && apk add --no-cache --virtual .build-deps-full         binutils-gold         g++         gcc         gnupg         libgcc         linux-headers         make         python3     && export GNUPGHOME=\"$(mktemp -d)\"     && for key in       4ED778F539E3634C779C87C6D7062848A1AB005C       141F07595B7B3FFE74309A937405533BE57C7D57       74F12602B6F1C4E913FAA37AD3A89613643B6201       DD792F5973C6DE52C432CBDAC77ABFA00DDBF2B7       61FC681DFB92A079F1685E77973F295594EC4689       8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600       C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8       890C08DB8579162FEE0DF9DB8BEAB4DFCF555EF4       C82FA3AE1CBEDC6BE46B9360C43CEC45C17AB93C       108F52B48DB57BB0CC439B2997B01419BD92F80A       A363A499291CBBC940DD62E41F10027AF002F8B0     ; do       gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys \"$key\" ||       gpg --batch --keyserver keyserver.ubuntu.com --recv-keys \"$key\" ;     done     && curl -fsSLO --compressed \"https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION.tar.xz\"     && curl -fsSLO --compressed \"https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc\"     && gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc     && gpgconf --kill all     && rm -rf \"$GNUPGHOME\"     && grep \" node-v$NODE_VERSION.tar.xz\\$\" SHASUMS256.txt | sha256sum -c -     && tar -xf \"node-v$NODE_VERSION.tar.xz\"     && cd \"node-v$NODE_VERSION\"     && ./configure     && make -j$(getconf _NPROCESSORS_ONLN) V=     && make install     && apk del .build-deps-full     && cd ..     && rm -Rf \"node-v$NODE_VERSION\"     && rm \"node-v$NODE_VERSION.tar.xz\" SHASUMS256.txt.asc SHASUMS256.txt;   fi   && rm -f \"node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz\"   && find /usr/local/include/node/openssl/archs -mindepth 1 -maxdepth 1 ! -name \"$OPENSSL_ARCH\" -exec rm -rf {} \\;   && apk del .build-deps   && node --version   && npm --version" did not complete successfully: exit code: 2

Steps to Reproduce

Try to use the build command I supplied

@LaurentGoderre
Copy link
Member

LIkely related to nodejs/node#42888

@ELHart05
Copy link

Not sure If you found a solution or not, I had a similar issue with node image labeled node:20.10.0-alpine with this logged in my gitlab pipeline log

------
 > [internal] load metadata for docker.io/library/node:20.10-alpine:
------
Dockerfile:1
--------------------
   1 | >>> FROM node:20.10-alpine
   2 |     
   3 |     ARG build_type="production"
--------------------
ERROR: failed to solve: node:20.10-alpine: failed to resolve source metadata for docker.io/library/node:20.10-alpine: failed to authorize: failed to fetch oauth token: unexpected status from POST request to https://auth.docker.io/token: 502 Bad Gateway

The solution was to change the docker image, my case I used node:20.17-alpine instead.

Make sure just to retest the build locally with this version, as you may have changes based on this version!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants