optimism icon indicating copy to clipboard operation
optimism copied to clipboard

Build docker images for ARM

Open 0xabhinav opened this issue 2 years ago • 1 comments

Is your feature request related to a problem? Please describe. Hi, Would it be possible to build your docker images for ARM? This will help us run nodes on m1 macs and graviton aws instances. I'm specially interested in the super-awesome healthcheck image since it works for other EVM chains' nodes as well and help us keep track of nodes going bad. Please lmk if it's possible to build a dockerfile which will allow me to do this myself too instead. Thanks!

Describe the solution you'd like A clear and concise description of what you want to happen.

Describe alternatives you've considered Tried writing the dockerfile below, ran it on an AWS graviton instance and kept getting 'Unknown system error -8'

FROM ethereumoptimism/foundry:latest as foundry
FROM node:16-alpine3.14

WORKDIR /
RUN apk --no-cache add curl \
    jq \
    python3 \
    ca-certificates \
    git \
    make \
    gcc \
    musl-dev \
    linux-headers \
    bash \
    build-base \
    gcompat \
    git

RUN git clone https://github.com/ethereum-optimism/optimism.git
COPY --from=foundry /usr/local/bin/forge /usr/local/bin/forge
COPY --from=foundry /usr/local/bin/cast /usr/local/bin/cast

WORKDIR /optimism
RUN yarn install --frozen-lockfile && yarn cache clean
RUN yarn build


WORKDIR /optimism/packages/replica-healthcheck
ENTRYPOINT ["npm", "run", "start"]

I also tried just building replica-healthcheck and ended up getting a bunch of TypeScript compile errors.

Additional context Traceback:-

=> ERROR [stage-1  8/10] RUN yarn build                                                                                                                 16.8s
------
 > [stage-1  8/10] RUN yarn build:
#0 0.786 yarn run v1.22.19
#0 0.834 $ yarn lerna run build
#0 1.175 $ /optimism/node_modules/.bin/lerna run build
#0 1.577 lerna notice cli v4.0.0
#0 1.580 lerna info versioning independent
#0 1.677 lerna info Executing command in 14 packages: "yarn run build"
#0 5.992 lerna info run Ran npm script 'build' in '@eth-optimism/core-utils' in 4.3s:
#0 5.993 $ tsc -p tsconfig.json
#0 7.961 lerna info run Ran npm script 'build' in '@eth-optimism/hardhat-deploy-config' in 6.3s:
#0 7.961 $ tsc -p tsconfig.json
#0 12.90 lerna info run Ran npm script 'build' in '@eth-optimism/common-ts' in 6.9s:
#0 12.90 $ tsc -p tsconfig.json
#0 16.69 lerna ERR! yarn run build exited 1 in '@eth-optimism/contracts-bedrock'
#0 16.69 lerna ERR! yarn run build stdout:
#0 16.69 $ yarn ts-node scripts/verify-foundry-install.ts
#0 16.69 $ /optimism/node_modules/.bin/ts-node scripts/verify-foundry-install.ts
#0 16.69 $ hardhat compile && yarn autogen:artifacts && yarn build:ts && yarn typechain
#0 16.69 
#0 16.69 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
#0 16.69 lerna ERR! yarn run build stderr:
#0 16.69 Solidity 0.8.15 is not fully supported yet. You can still use Hardhat, but some features, like stack traces, might not work correctly.
#0 16.69 
#0 16.69 Learn more at https://hardhat.org/reference/solidity-support
#0 16.69 
#0 16.69 An unexpected error occurred:
#0 16.69 Error: spawn Unknown system error -8
#0 16.69     at ChildProcess.spawn (node:internal/child_process:413:11)
#0 16.69     at spawn (node:child_process:700:9)
#0 16.69     at /optimism/packages/contracts-bedrock/node_modules/@foundry-rs/hardhat-forge/src/forge/build/build.ts:36:26
#0 16.69     at new Promise (<anonymous>)
#0 16.69     at spawnBuild (/optimism/packages/contracts-bedrock/node_modules/@foundry-rs/hardhat-forge/src/forge/build/build.ts:35:10)
#0 16.69     at async OverriddenTaskDefinition._action (/optimism/packages/contracts-bedrock/node_modules/@foundry-rs/hardhat-forge/src/forge/build/index.ts:20:5)
#0 16.69     at async Environment._runTaskDefinition (/optimism/node_modules/hardhat/src/internal/core/runtime-environment.ts:219:14)
#0 16.69     at async Environment.run (/optimism/node_modules/hardhat/src/internal/core/runtime-environment.ts:131:14)
#0 16.69     at async main (/optimism/node_modules/hardhat/src/internal/cli/cli.ts:218:5) {
#0 16.69   errno: -8,
#0 16.69   code: 'Unknown system error -8',
#0 16.69   syscall: 'spawn'
#0 16.69 }
#0 16.69 error Command failed with exit code 1.
#0 16.69 lerna ERR! yarn run build exited 1 in '@eth-optimism/contracts-bedrock'
#0 16.69 lerna WARN complete Waiting for 2 child processes to exit. CTRL-C to exit immediately.
#0 16.71 error Command failed with exit code 1.
#0 16.71 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
#0 16.73 error Command failed with exit code 1.
#0 16.73 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
------
failed to solve: executor failed running [/bin/sh -c yarn build]: exit code: 1

0xabhinav avatar Dec 16 '22 07:12 0xabhinav

Hello, It looks like when the environment runs run yarn build it is trying to run a command that is not compatible with the AWS Graviton instances. It could also be due to some missing dependencies that are not specified in the Dockerfile that are required to run the command. Without more information about the specific error message and the environment in which the Dockerfile is being run, it is difficult to say for sure what the issue is.

This may not be super helpful considering you are running it within aws, but I often have issues building docker containers on my M1 Mac, and the issue is almost always fixed by changing the second line FROM node:16-alpine3.14 to

FROM node:16-slim
RUN apt-get update
RUN apt-get install -y openssl

I hope this helps you get closer to resolving the issue.

meaghanfitzgerald avatar Jan 25 '23 04:01 meaghanfitzgerald

Closing as dupe of #3606

smartcontracts avatar Mar 05 '24 18:03 smartcontracts