Open jdmueller opened 8 months ago
I have also tried to build this on my local Mac mini M2 and the build command will not run getting the same error as hub.docker.com even with the env variable set before running. It will work however if I run 'docker compose up' command.
export NEXT_PUBLIC_SALEOR_API_URL=http://localhost:8000/graphql/
[builder 6/6] RUN pnpm build: 0.475 0.475 > saleor-storefront@0.1.0 prebuild /app 0.475 > pnpm run generate 0.475 0.742 0.742 > saleor-storefront@0.1.0 generate /app 0.742 > graphql-codegen --config .graphqlrc.ts 0.742 1.496 Before GraphQL types can be generated, you need to set NEXT_PUBLIC_SALEOR_API_URL environment variable. 1.496 Follow development instructions in the README.md file. 1.503 ELIFECYCLE Command failed with exit code 1. 1.512 ELIFECYCLE Command failed with exit code 1.
Dockerfile:37
35 | RUN yarn global add pnpm@$PNPM_VERSION 36 |
37 | >>> RUN pnpm build 38 |
39 | # Production image, copy all the files and run nextERROR: failed to solve: process "/bin/sh -c pnpm build" did not complete successfully: exit code: 1
I've submitted a pull request (#1069) that addresses the issue reported. This pull request aims to resolve the problem related to building the Docker image using Docker Compose.
These simple steps are enough to run the application in the basic version:
git clone https://github.com/saleor/storefront.git .
cp .env.example .env
docker-compose build
docker-compose up
Let me know what stage you are at. If you still have a problem with this, it seems to me that the machine you are building it on may not have enough free resources.
Summary
I have followed the directions: cloned the repo, cp .env.example to .env, I have run pnpm i. When I create a docker image of this repo it fails with the same reason/text/error above from original poster. I saw also that the .env file was being ignored by the .gitignore file and even changing this does not fix it. It has been 3 years since I worked with a saleor store and I am not sure what I could be doing wrong since the directions seem simple enough to follow. I have used this process for Saleor and Dashboard and they create the docker images without any errors.
2024-01-10T16:04:12Z > [builder 6/6] RUN pnpm build: 2024-01-10T16:04:12Z https://github.com/saleor/storefront/pull/22 1.681 > pnpm run generate 2024-01-10T16:04:12Z https://github.com/saleor/storefront/pull/22 1.681 2024-01-10T16:04:12Z https://github.com/saleor/storefront/pull/22 2.895 2024-01-10T16:04:12Z https://github.com/saleor/storefront/pull/22 2.895 > saleor-storefront@0.1.0 generate /app 2024-01-10T16:04:12Z https://github.com/saleor/storefront/pull/22 2.895 > graphql-codegen --config .graphqlrc.ts 2024-01-10T16:04:12Z https://github.com/saleor/storefront/pull/22 2.895 2024-01-10T16:04:12Z https://github.com/saleor/storefront/pull/22 5.155 Before GraphQL types can be generated, you need to set NEXT_PUBLIC_SALEOR_API_URL environment variable. 2024-01-10T16:04:12Z https://github.com/saleor/storefront/pull/22 5.157 Follow development instructions in the README.md file. 2024-01-10T16:04:12Z https://github.com/saleor/storefront/pull/22 5.223 ELIFECYCLE Command failed with exit code 1. 2024-01-10T16:04:12Z https://github.com/saleor/storefront/pull/22 5.246 ELIFECYCLE Command failed with exit code 1. 2024-01-10T16:04:12Z ------ 2024-01-10T16:04:12Z ERROR: failed to solve: executor failed running [/bin/sh -c pnpm build]: exit code: 1 2024-01-10T16:04:12Z Build failed using Buildkit (1)
I have this being built within the hub.docker system straight from my GitHub repo.
I have even specified these in the build variables section of the hub.docker system and the build still fails. I don't understand why the other 2 images (Saleor 3.18 and Dashboard 3.18) will build correctly but this one does not.
This repo will however work if I use 'docker compose up' from my local computer m2 Mac.
Steps to reproduce
2024-01-10T23:53:14Z > [builder 6/6] RUN pnpm build: 2024-01-10T23:53:14Z #22 1.761 > pnpm run generate 2024-01-10T23:53:14Z #22 1.761 2024-01-10T23:53:14Z #22 2.992 2024-01-10T23:53:14Z #22 2.992 > saleor-storefront@0.1.0 generate /app 2024-01-10T23:53:14Z #22 2.992 > graphql-codegen --config .graphqlrc.ts 2024-01-10T23:53:14Z #22 2.992 2024-01-10T23:53:14Z #22 5.275 Before GraphQL types can be generated, you need to set NEXT_PUBLIC_SALEOR_API_URL environment variable. 2024-01-10T23:53:14Z #22 5.277 Follow development instructions in the README.md file. 2024-01-10T23:53:14Z #22 5.343 ELIFECYCLE Command failed with exit code 1. 2024-01-10T23:53:14Z #22 5.370 ELIFECYCLE Command failed with exit code 1. 2024-01-10T23:53:14Z ------ 2024-01-10T23:53:14Z ERROR: failed to solve: executor failed running [/bin/sh -c pnpm build]: exit code: 1 2024-01-10T23:53:14Z Build failed using Buildkit (1)
A link to a reproduction repository
https://github.com/jdmueller/AdventureStorefront
Output from envinfo
No response