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.

Home Page:https://demo.saleor.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Depedency conflict with M1 ARM

TimLS94 opened this issue · comments

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

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.

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

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.

@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

@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,

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

Thank you,

First, edit your Dockerfile files:

  • saleor-storefront/Dockerfile.dev
  • saleor-dashboard/Dockerfile.dev (optional)
  • saleor/Dockerfile (optional)

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
  • Some IDE will warning the syntax is invalid (after FROM has -- symbol), you can skip it.
  • I tested on M1 devices, run perfectly when change the file saleor-storefront/Dockerfile.dev. You can skip for other Dockerfile.