Skip to content

[buildx/arm64] yarn and npm not able to download packages from internet #1335

Open
@voydz

Description

@voydz

Hi there,

thanks for your awesome work with this project. I am experiencing issues using buildx for the arm64 arch. Everything is running smooth until yarn or npm is trying to download packages over the network.

This is an snipped from build-log running on GitHub actions while using yarn:

#22 [linux/arm64 build-deps 5/6] RUN yarn --production
#22 176.3 info There appears to be trouble with your network connection. Retrying...
#22 195.3 error An unexpected error occurred: "https://registry.yarnpkg.com/date-fns/-/date-fns-2.16.1.tgz: ESOCKETTIMEDOUT".

Running the same buildx build locally the output is a bit more concise:

 => [linux/arm64 build-deps 5/6] RUN yarn --production
 => => # Unknown QEMU_IFLA_INFO_KIND ipip                                                                                                
 => => # Unknown QEMU_IFLA_INFO_KIND ip6tnl                                                                                              
 => => # yarn install v1.22.5                                                                                                            
 => => # Unknown QEMU_IFLA_INFO_KIND ipip                                                                                                
 => => # Unknown QEMU_IFLA_INFO_KIND ip6tnl                                                                                              
 => => # [1/4] Resolving packages...                                                                                   
 => => # [2/4] Fetching packages...                                                                                                      
 => => # Unknown QEMU_IFLA_INFO_KIND ipip                                                                                                
 => => # Unknown QEMU_IFLA_INFO_KIND ip6tnl                                                                                              
 => => # info There appears to be trouble with your network connection. Retrying...  

The command used to start the build:
docker buildx build --platform linux/amd64,linux/arm64 -t myrepo/myproject:latest --push client/

My Dockerfile looks like this:
(Note that I do not copy node_modules into build context. The files to copy are managed using a .dockerignore file.)

# Stage 1 - the build process
FROM node:latest as build-deps
WORKDIR /usr/src/app

ARG REACT_APP_GRAPH_URL
ENV REACT_APP_GRAPH_URL=$REACT_APP_GRAPH_URL

COPY . ./
COPY .env.example .env

RUN yarn --production
RUN yarn build

# Stage 2 - the deployment
FROM nginx:latest
COPY --from=build-deps /usr/src/app/build /usr/share/nginx/html

COPY docker/default /etc/nginx/conf.d/default.conf

Workaround

As a workaround I currently using a .yarnrc to create an offline cache. I copy a it into the build context and install it with the yarn --offline option. That works for now, but I do not like it very much. https://classic.yarnpkg.com/blog/2016/11/24/offline-mirror/

thank you again and best regards

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions