You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For some background - I've recently been experimenting with Docker images for building a documentation tool for Gatsby, so you can see an example of building a Gatsby friendly container there. Sadly my image is the standard full-fat Node.js / Ubuntu image.
For reference, I ran docker run -it --rm -v $(pwd)/site:/site aripalo/gatsby-docker yarn add gatsby-plugin-sharp
And the error output was:
error /site/node_modules/sharp: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments:
Directory: /site/node_modules/sharp
Output:
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:483:19)
gyp ERR! stack at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:397:16)
gyp ERR! stack at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:68:16)
gyp ERR! stack at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/which/node_modules/isexe/index.js:42:5
gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/which/node_modules/isexe/mode.js:8:5
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:166:21)
gyp ERR! System Linux 4.9.60-linuxkit-aufs
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /site/node_modules/sharp
The text was updated successfully, but these errors were encountered:
Good catch! I haven't yet gotten myself so far as to use gatsby-plugin-sharp with this Docker setup, but that is something this should support of course!
So I finally got the gatsby-plugin-sharp to succesfully install. Had to add quite a lot of new dependencies.
I created a PR #2, which I will close after I've had time to do more testing and figure out if I can get rid of some dependencies (probably won't have time before sunday).
I saw this article the other day. Section 5 talks about installing dependencies and building files in one layer, then creating a fresh layer and copying in only the built files. Which should result in a smaller final image.. maybe it's possible to do the same with sharp?
Hi @aripalo, this looks great!
I tried installing
gatsby-plugin-sharp
, but it fails because it doesn't have all the tools available to buildsharp
and / or its dependencies. Luckily there is an Alpine image that contains those dependencies already - see https://github.com/lovell/sharp/blob/master/docs/install.md#dockerFor some background - I've recently been experimenting with Docker images for building a documentation tool for Gatsby, so you can see an example of building a Gatsby friendly container there. Sadly my image is the standard full-fat Node.js / Ubuntu image.
For reference, I ran
docker run -it --rm -v $(pwd)/site:/site aripalo/gatsby-docker yarn add gatsby-plugin-sharp
And the error output was:
The text was updated successfully, but these errors were encountered: