saleor / saleor-storefront

A GraphQL-powered, NextJs-based, PWA storefront for Saleor. IMPORTANT: This project is [DEPRECATED] in favor of saleor/react-storefront soon to become our default demo and storefront starter pack.
https://demo.saleor.io/
BSD 3-Clause "New" or "Revised" License
770 stars 672 forks source link

Depedency conflict with M1 ARM #1018

Closed TimLS94 closed 3 years ago

TimLS94 commented 3 years ago

What I'm trying to achieve

When trying to run Saleor on a M1 ARM macbook, a conflict with phantom.js in the storefront repo occurs. With my Intel Macbook this error does not occur.

Steps to reproduce the problem

  1. Follow the steps on saleor-platform README.md

What I expected to happen

Running Saleor

System information Using Saleor 2.11.8, Dashboard 2.11.1, Storefront 2.11 Operating system: macOS Big Sur, Version 11.1

tkahng commented 3 years ago

with images that dont build properly for arm chips, one thing i did was to use the --platform flag for each services in docker-compose.yml. however the current mac previews docker-compose has a bug where it ignores the flag. so i removed the built-in docker-compose cli, got the newest one via curl(method stated in the compose install docs for linux), and added platform: linux/amd64 for each service in the yml, and FROM --platform=linux/amd64 python:3.8 as build-python or similar for each dockerfile. with experimental features and buildkit on, docker-compose should build for amd64, with no issues on m1, but i do get stuck with timing out when running the containers for dashboard and storefront.

krzysztofwolski commented 3 years ago

Unforinetly the team won't be able to address this issue, we don't have any m1 machines.

TimLS94 commented 3 years ago

Unforinetly the team won't be able to address this issue, we don't have any m1 machines.

Thank you for the response. I have worked around the problem by using Ubuntu with a virtual machine.

BBartosz commented 3 years ago

@tkahng solution works, need to add --platform=linux/amd64 in dockerfiles in macbook m1. About timeout: restart of docker desktop helps :) + better to start storefront/dashboard container not from docker-compose up but individually from docker desktop

tiendq commented 3 years ago

@tkahng could you explain more detail about changes? I also got build error with M1 :(

Thank you,

dphans commented 3 years ago

@tkahng could you explain more detail about changes? I also got build error with M1 :(

Thank you,

@tkahng could you explain more detail about changes? I also got build error with M1 :(

Thank you,

First, edit your Dockerfile files:

While declaring which image use for Dockerfile (FROM keyword). You should declare implicit which architecture are you using. For me, on M1 devices, using amd64, so my Dockerfile content like below (note the first line):

FROM --platform=linux/amd64 node:10
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
ARG API_URI
ENV API_URI ${API_URI:-http://localhost:8000/graphql/}

EXPOSE 3000
CMD npm start -- --host 0.0.0.0