Skip to content

Docker Build Error ARG or ENV missing during build process NEXT_PUBLIC_SALEOR_API_URL #1067

@jdmueller

Description

@jdmueller

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 #22 1.681 > pnpm run generate
2024-01-10T16:04:12Z #22 1.681
2024-01-10T16:04:12Z #22 2.895
2024-01-10T16:04:12Z #22 2.895 > saleor-storefront@0.1.0 generate /app
2024-01-10T16:04:12Z #22 2.895 > graphql-codegen --config .graphqlrc.ts
2024-01-10T16:04:12Z #22 2.895
2024-01-10T16:04:12Z #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 #22 5.157 Follow development instructions in the README.md file.
2024-01-10T16:04:12Z #22 5.223  ELIFECYCLE  Command failed with exit code 1.
2024-01-10T16:04:12Z #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.

Screenshot 2024-01-10 at 5 12 37 PM 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

  1. Clone repo
  2. cp .env.example to .env file and configure settings
  3. run ppm i
  4. add image to hub.docker.com and set as automatic build from GitHub repo
  5. add build arguments into section for NEXT_PUBLIC_SALEOR_API_URL and NEXT_PUBLIC_STOREFRONT_URL
  6. Build process fails with error:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions