paritytech / substrate-api-sidecar

REST service that makes it easy to interact with blockchain nodes built using Substrate's FRAME framework.
https://paritytech.github.io/substrate-api-sidecar/dist/
GNU General Public License v3.0
245 stars 151 forks source link

Add docker support for linux/arm64/v8 #1259

Closed kitti-katy closed 10 months ago

kitti-katy commented 1 year ago

I have Mac M1 and when trying to run the docker image from docker.io/parity/substrate-api-sidecar:latest I get:

➜  substrate-api docker run --rm -it --read-only -p 8080:8080 parity/substrate-api-sidecar
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested

#
# Fatal process OOM in Failed to reserve virtual memory for CodeRange
#

qemu: uncaught target signal 5 (Trace/breakpoint trap) - core dumped
TarikGul commented 1 year ago

Hmm, this is interesting. I am running it on Macbook Pro M2 and have no issues. I'll give this a look.

TarikGul commented 1 year ago

Okay so I was able to reproduce the warning: That being said the image still runs which is also weird.

WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
TarikGul commented 1 year ago

Currently also getting the following error when running docker build --platform linux/arm/v8 -t substrate-api-sidecar . or just plain docker build -t substrate-api-sidecar .:

 => [internal] load build definition from Dockerfile                                                                                                                                                   0.0s
 => => transferring dockerfile: 37B                                                                                                                                                                    0.0s
 => [internal] load .dockerignore                                                                                                                                                                      0.0s
 => => transferring context: 34B                                                                                                                                                                       0.0s
 => [internal] load metadata for docker.io/library/node:16.15.1-alpine                                                                                                                                 0.4s
 => [internal] load build context                                                                                                                                                                      0.6s
 => => transferring context: 1.63MB                                                                                                                                                                    0.6s
 => [builder 1/4] FROM docker.io/library/node:16.15.1-alpine@sha256:c785e617c8d7015190c0d41af52cc69be8a16e3d9eb7cb21f0bb58bcfca14d6b                                                                   0.0s
 => CACHED [builder 2/4] WORKDIR /opt/builder                                                                                                                                                          0.0s
 => [builder 3/4] COPY . .                                                                                                                                                                             1.1s
 => ERROR [builder 4/4] RUN yarn install &&     yarn build                                                                                                                                             5.7s
------                                                                                                                                                                                                      
 > [builder 4/4] RUN yarn install &&     yarn build:                                                                                                                                                        
#9 0.611 ➤ YN0000: ┌ Resolution step                                                                                                                                                                        
#9 0.716 ➤ YN0002: │ @substrate/api-sidecar@workspace:. doesn't provide typescript (p2e330), requested by tsc-watch                                                                                         
#9 0.716 ➤ YN0002: │ @substrate/dev@npm:0.6.6 doesn't provide @babel/core (pd2869), requested by @babel/plugin-transform-modules-commonjs                                                                   
#9 0.716 ➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code                                      
#9 0.718 ➤ YN0000: └ Completed
#9 0.719 ➤ YN0000: ┌ Fetch step
#9 0.932 ➤ YN0000: └ Completed in 0s 213ms
#9 0.956 ➤ YN0000: ┌ Link step
#9 5.505 ➤ YN0007: │ wasm-pack@npm:0.10.3 must be built because it never has been before or the last one failed
#9 5.589 ➤ YN0009: │ wasm-pack@npm:0.10.3 couldn't be built successfully (exit code 1, logs can be found here: /tmp/xfs-04106019/build.log)
#9 5.589 ➤ YN0000: └ Completed in 4s 632ms
#9 5.593 ➤ YN0000: Failed with errors in 4s 984ms