Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: docker production build #693

Merged
merged 5 commits into from
Jul 2, 2020
Merged

Conversation

mikemurray
Copy link
Member

@mikemurray mikemurray commented Jul 1, 2020

Resolves #691
Impact: critical
Type: bugfix|chore

Issue

Docker production builds are failing

Solution

  • Remove the quotes and ignore the lint issue in the DoclerFile
  • Adjust some code related to page optimization so the build doesn't fail if the next app isn't connected to the API

Breaking changes

none

Testing

  1. Run the app locally and verify the product and tags pages still work
  2. Test the docker build
docker build --network=host -t reactioncommerce/example-storefront:3.1.0
  1. Run with
docker run -it --name storefront2 -p 4000:4000 --env-file .env.prod --network reaction.localhost reactioncommerce/example-storefront:3.1.0

Signed-off-by: Mike Murray <hellomikemurray@gmail.com>
@mikemurray
Copy link
Member Author

@janus-reith With the code commented out the docker build is getting further, but it's encountering issues when optimizing pages. The API is not running on CI so this is causing the build to fail. Do you know have any ideas on how to solve this?

error-fetching-graphql FetchError: request to http://localhost:3000/graphql failed, reason: connect ECONNREFUSED 127.0.0.1:3000
 
    at ClientRequest.<anonymous> (/usr/local/src/app/node_modules/next/dist/compiled/node-fetch/index.js:1:147710)
 
    at ClientRequest.emit (events.js:315:20)
 
    at Socket.socketErrorListener (_http_client.js:426:9)
 
    at Socket.emit (events.js:315:20)
 
    at emitErrorNT (internal/streams/destroy.js:92:8)
 
    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
 
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
 
  type: 'system',
 
  errno: 'ECONNREFUSED',
 
  code: 'ECONNREFUSED'
 
}

Signed-off-by: Mike Murray <hellomikemurray@gmail.com>
Signed-off-by: Mike Murray <hellomikemurray@gmail.com>
Signed-off-by: Mike Murray <hellomikemurray@gmail.com>
Signed-off-by: Mike Murray <hellomikemurray@gmail.com>
@mikemurray mikemurray marked this pull request as ready for review July 2, 2020 18:06
@focusaurus focusaurus merged commit 1ce0457 into trunk Jul 2, 2020
@focusaurus focusaurus deleted the fix-691-mikemurray-dockerfile branch July 2, 2020 22:03
@janus-reith
Copy link
Collaborator

@mikemurray This seems to indicate that no GraphQL API is available at that url, which is expected when running in your CI.
localhost:3000 would only be available on the same machine (with docker host network access).
You need to point BUILD_GRAPHQL_URL to a running API.
I noted some of my considerations here: #667 (comment)

@kieckhafer kieckhafer mentioned this pull request Sep 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Production docker builds are broken due to some change in the Dockerfile
3 participants