DEV Community

Discussion on: My Docker Setup For GatsbyJS (and NextJS)

Collapse
 
yanlinaung profile image
Yan Lin Aung

Thanks for sharing.
I have tried in ubuntu host and encountered this error.

Building web
Step 1/10 : FROM node:alpine
 ---> 09084e4ff58d
Step 2/10 : EXPOSE 8000 9929 9230
 ---> Using cache
 ---> 12194df00fcb
Step 3/10 : RUN   apk add --no-cache python make g++ &&   apk add vips-dev fftw-dev --no-cache --repository  http://dl-3.alpinelinux.org/alpine/edge/testing --repository http://dl-3.alpinelinux.org/alpine/edge/main &&   rm -fR /var/cache/apk/*
 ---> Using cache
 ---> 936946e189e0
Step 4/10 : RUN npm install -g gatsby-cli yarn
 ---> Using cache
 ---> 50623ae2aed6
Step 5/10 : RUN gatsby --version
 ---> Using cache
 ---> 092ab6af8975
Step 6/10 : WORKDIR /app
 ---> Using cache
 ---> 0f7947e32f24
Step 7/10 : COPY ./package.json .
 ---> Using cache
 ---> b46673afd483
Step 8/10 : RUN yarn install && yarn cache clean
 ---> Using cache
 ---> 6355f4a32eb1
Step 9/10 : COPY . .
 ---> 28cc60e9ffa2
Step 10/10 : ENTRYPOINT ["gatsby", "develop", "-H", "0.0.0.0"]
 ---> Running in e1ffe181301b
Removing intermediate container e1ffe181301b
 ---> deaf62676e11
Successfully built deaf62676e11
Successfully tagged blog-name-blog_web:latest
Recreating blog-name-blog_web_1 ... done
Attaching to blog-name-blog_web_1
web_1  | /bin/sh: lscpu: not found
web_1  | success open and validate gatsby-configs — 0.026 s
web_1  | success load plugins — 0.544 s
web_1  | success onPreInit — 6.206 s
web_1  | success initialize cache — 0.037 s
web_1  | success copy gatsby files — 0.075 s
web_1  | warning gatsby-plugin-feed was initialized in gatsby-config.js without a feeds option.
web_1  | This means that we the plugin will use the internal RSS feed creation, which may not match your use case.
web_1  | This behavior will be removed in the next major release of gatsby-plugin-feed.
web_1  | For more info, check out: https://gatsby.app/adding-rss-feed
web_1  | success onPreBootstrap — 0.071 s
web_1  | success source and transform nodes — 0.087 s
web_1  | success building schema — 0.220 s
web_1  | error gatsby-node.js returned an error
web_1  | 
web_1  | 
web_1  |   GraphQLError: Cannot query field "allMarkdownRemark" on type "Query".
web_1  |   
web_1  |   - new Promise
web_1  |   
web_1  |   - index.js:358 graphqlRunner
web_1  |     [app]/[gatsby]/dist/bootstrap/index.js:358:14
web_1  |   
web_1  |   - gatsby-node.js:8 Object.exports.createPages
web_1  |     /app/gatsby-node.js:8:10
web_1  |   
web_1  |   - api-runner-node.js:202 runAPI
web_1  |     [app]/[gatsby]/dist/utils/api-runner-node.js:202:37
web_1  |   
web_1  |   - api-runner-node.js:340 resolve
web_1  |     [app]/[gatsby]/dist/utils/api-runner-node.js:340:19
web_1  |   
web_1  |   - debuggability.js:313 Promise._execute
web_1  |     [app]/[bluebird]/js/release/debuggability.js:313:9
web_1  |   
web_1  |   - promise.js:483 Promise._resolveFromExecutor
web_1  |     [app]/[bluebird]/js/release/promise.js:483:18
web_1  |   
web_1  |   - promise.js:79 new Promise
web_1  |     [app]/[bluebird]/js/release/promise.js:79:10
web_1  |   
web_1  | 
web_1  | success createPages — 0.117 s
web_1  | success createPagesStatefully — 0.041 s
web_1  | success onPreExtractQueries — 0.002 s
web_1  | success update schema — 0.016 s
web_1  | error GraphQL Error There was an error while compiling your site's GraphQL queries.
web_1  |   Error: RelayParser: Encountered 3 error(s):
web_1  | - Unknown field 'file' on type 'Query'. Source: document `BioQuery` file: `GraphQL request`
web_1  |   
web_1  |   GraphQL request (3:5)
web_1  |   2:   query BioQuery {
web_1  |   3:     avatar: file(absolutePath: { regex: "/profile-pic.jpg/" }) {
web_1  |          ^
web_1  |   4:       childImageSharp {
web_1  |   
web_1  | - Unknown field 'allMarkdownRemark' on type 'Query'. Source: document `appSrcPagesIndexJs2785444898` file: `GraphQL request`
web_1  |   
web_1  |   GraphQL request (8:5)
web_1  |   7:     }
web_1  |   8:     allMarkdownRemark(sort: { fields: [frontmatter___date], order: DESC }) {
web_1  |          ^
web_1  |   9:       edges {
web_1  |   
web_1  | - Unknown field 'markdownRemark' on type 'Query'. Source: document `BlogPostBySlug` file: `GraphQL request`
web_1  |   
web_1  |   GraphQL request (9:5)
web_1  |    8:     }
web_1  |    9:     markdownRemark(fields: { slug: { eq: $slug } }) {
web_1  |           ^
web_1  |   10:       id
web_1  |   
web_1  |     
web_1  | success extract queries from components — 0.076 s
web_1  | success run graphql queries — 0.016 s — 4/4 268.63 queries/second
web_1  | success write out page data — 0.012 s
web_1  | success write out redirect data — 0.011 s
web_1  | success onPostBootstrap — 0.186 s
web_1  | 
web_1  | info bootstrap finished - 22.567291911 s
web_1  | 
web_1  |  ERROR  Failed to compile with 2 errors6:31:15 AM
web_1  | 
web_1  |  error  in ./src/components/bio.js
web_1  | 
web_1  | Module Error (from ./node_modules/eslint-loader/index.js):
web_1  | 
web_1  | /app/src/components/bio.js
web_1  |   57:5  error  Cannot query field "file" on type "Query". Did you mean "site"?  graphql/template-strings
web_1  | 
web_1  | ✖ 1 problem (1 error, 0 warnings)
web_1  | 
web_1  | 
web_1  |  @ ./src/pages/index.js 10:0-36 36:28-31
web_1  |  @ ./.cache/sync-requires.js
web_1  |  @ ./.cache/app.js
web_1  |  @ multi event-source-polyfill (webpack)-hot-middleware/client.js?path=/__webpack_hmr&reload=true&overlay=false ./.cache/app
web_1  | 
web_1  |  error  in ./src/pages/index.js
web_1  | 
web_1  | Module Error (from ./node_modules/eslint-loader/index.js):
web_1  | 
web_1  | /app/src/pages/index.js
web_1  |   58:5  error  Cannot query field "allMarkdownRemark" on type "Query"  graphql/template-strings
web_1  | 
web_1  | ✖ 1 problem (1 error, 0 warnings)
web_1  | 
web_1  | 
web_1  |  @ ./.cache/sync-requires.js 17:54-88
web_1  |  @ ./.cache/app.js
web_1  |  @ multi event-source-polyfill (webpack)-hot-middleware/client.js?path=/__webpack_hmr&reload=true&overlay=false ./.cache/app
web_1  | 
web_1  | ℹ 「wdm」: Failed to compile.
web_1  | ✖ 「wdm」: 
web_1  | ERROR in ./src/components/bio.js
web_1  | Module Error (from ./node_modules/eslint-loader/index.js):
web_1  | 
web_1  | /app/src/components/bio.js
web_1  |   57:5  error  Cannot query field "file" on type "Query". Did you mean "site"?  graphql/template-strings
web_1  | 
web_1  | ✖ 1 problem (1 error, 0 warnings)
web_1  | 
web_1  |  @ ./src/pages/index.js 10:0-36 36:28-31
web_1  |  @ ./.cache/sync-requires.js
web_1  |  @ ./.cache/app.js
web_1  |  @ multi event-source-polyfill (webpack)-hot-middleware/client.js?path=/__webpack_hmr&reload=true&overlay=false ./.cache/app
web_1  | 
web_1  | ERROR in ./src/pages/index.js
web_1  | Module Error (from ./node_modules/eslint-loader/index.js):
web_1  | 
web_1  | /app/src/pages/index.js
web_1  |   58:5  error  Cannot query field "allMarkdownRemark" on type "Query"  graphql/template-strings
web_1  | 
web_1  | ✖ 1 problem (1 error, 0 warnings)
web_1  | 
web_1  |  @ ./.cache/sync-requires.js 17:54-88
web_1  |  @ ./.cache/app.js
web_1  |  @ multi event-source-polyfill (webpack)-hot-middleware/client.js?path=/__webpack_hmr&reload=true&overlay=false ./.cache/app
Collapse
 
stoutlabs profile image
Daniel Stout • Edited

It's hard to say, but it looks like you may not have the gatsby-transformer-remark plugin installed and configured?

Sidenote, possibly relevant: If you add any new packages to your app, you will need to rebuild your image using docker-compose build (or docker-compose up --build)

Collapse
 
yanlinaung profile image
Yan Lin Aung

Thanks for your reply. It is weired. There is no problem when I run docker-compose up in alpine linux host on VPS. Thanks anyway!