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

API_URI not setting #942

Closed riipeckx closed 4 years ago

riipeckx commented 4 years ago

What I'm trying to achieve

Set the API_URI env in Docker Swarm by setting it in my docker-compose.yml

Steps to reproduce the problem

  1. Add this code to docker-compose.yml

    store:
    image: zeroexistence/saleor-storefront:2.11
    environment:
      - API_URI=http://core:8000/graphql/
    networks:
      - backend
  2. execute docker stack deploy -c docker-compose.yml <stackName>

  3. Head to the website

What I expected to happen

The container connects to the core one through the API_URI address contained in the docker-compose.yml

Screenshots

image The container connects through the default url, not the API_URI address contained in the docker-compose.yml

System information Operating system: Linux Debian 10 - Docker 19.03.13 Browser: Chrome Version 86.0.4240.183 (Official Build) (64-bit)

cyberdemic commented 4 years ago

In your Dockerfile try to change the API_URI to the correct website address(instead of localhost:8000) so when you build it, it builds with the correct API_URI.

I should note that I only needed to do this when using the production Dockerfile which runs "npm run build".

riipeckx commented 4 years ago

In your Dockerfile try to change the API_URI to the correct website address(instead of localhost:8000) so when you build it, it builds with the correct API_URI.

I should note that I only needed to do this when using the production Dockerfile which runs "npm run build".

In fact yes, when I rebuild the Docker Image, it afftects it well but this is not a good implementation of this Environment Variable.. But well, for the moment, i'll do that, thanks for your answer :)