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

Issue building docker container on M1 #26

Open
camfairchild opened this issue Mar 3, 2023 · 1 comment
Open

Issue building docker container on M1 #26

camfairchild opened this issue Mar 3, 2023 · 1 comment

Comments

@camfairchild
Copy link

camfairchild commented Mar 3, 2023

I keep coming across an error building the dockerfile on an M1 Pro.
This was due to not being able to install chromium for arm64.

 => ERROR [polkascan/explorer-ui builder  4/24] RUN npm i                                                          108.3s
------
 > [polkascan/explorer-ui builder  4/24] RUN npm i:
#0 79.88 npm WARN deprecated @npmcli/[email protected]: This functionality has been moved to @npmcli/fs
#0 107.6 npm notice 
#0 107.6 npm notice New minor version of npm available! 9.5.0 -> 9.6.0
#0 107.6 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v9.6.0>
#0 107.6 npm notice Run `npm install -g [email protected]` to update!
#0 107.6 npm notice 
#0 107.6 npm ERR! code 1
#0 107.6 npm ERR! path /app/polkadapt/node_modules/puppeteer
#0 107.6 npm ERR! command failed
#0 107.6 npm ERR! command sh -c node install.js
#0 107.6 npm ERR! The chromium binary is not available for arm64.
#0 107.6 npm ERR! If you are on Ubuntu, you can install with: 
#0 107.6 npm ERR! 
#0 107.6 npm ERR!  sudo apt install chromium
#0 107.6 npm ERR! 
#0 107.6 npm ERR! 
#0 107.6 npm ERR!  sudo apt install chromium-browser
#0 107.6 npm ERR! 
#0 107.6 npm ERR! ERROR: Failed to set up Chromium r1095492! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download.
#0 107.6 npm ERR! Error
#0 107.6 npm ERR!     at handleArm64 (/app/polkadapt/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserFetcher.js:137:11)
#0 107.6 npm ERR!     at BrowserFetcher.download (/app/polkadapt/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserFetcher.js:284:13)
#0 107.6 npm ERR!     at async downloadBrowser (/app/polkadapt/node_modules/puppeteer/lib/cjs/puppeteer/node/install.js:61:5)
#0 107.6 
#0 107.6 npm ERR! A complete log of this run can be found in:
#0 107.6 npm ERR!     /root/.npm/_logs/2023-03-03T00_30_48_200Z-debug-0.log

See: https://stackoverflow.com/a/72291691/7101091
I was able to fix it using

diff --git a/explorer-ui/Dockerfile b/explorer-ui/Dockerfile
index 4a5c777..29afd6b 100644
--- a/explorer-ui/Dockerfile
+++ b/explorer-ui/Dockerfile
@@ -2,6 +2,12 @@
 
 FROM node:lts as builder
 
+RUN apt update
+RUN apt install -y chromium
+
+# skips puppeteer installing chrome and points to correct binary
+ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
+
 # The application depends on PolkADAPT, so we have to install and build PolkADAPT first.
 
 WORKDIR /app/polkadapt
@wouterter
Copy link
Collaborator

Hey thanks for your report and your fix suggestion. We will implement this as well.

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

2 participants