aripalo / gatsby-docker Goto Github PK
View Code? Open in Web Editor NEWDevelop & Build GatsbyJS static sites within Docker.
License: MIT License
Develop & Build GatsbyJS static sites within Docker.
License: MIT License
Hi, could you please show me the command to dockerize a local project? the following always create a new starter gatsby site.
docker run -it --rm -v $(pwd)/.:/site -p 8000:8000 aripalo/gatsby-docker develop
docker run -it --rm -v $(pwd)/site:/site -p 8000:8000 aripalo/gatsby-docker develop
I'm running them in the root of my project, which has a package.json
Thanks
Hi !
I can't get to make it work on linux.
I'm struggling with user permission as generate files are root privileged and I'm not able to edit them from my host IDE.
Unless this problem, everything works like a charm.
Can you help ?
Step 1/10 : FROM node:9.5-alpine
9.5-alpine: Pulling from library/node
605ce1bd3f31: Pull complete
5c0ee846ddbc: Pull complete
4273d9861593: Pull complete
Digest: sha256:50ae5f22356c5a0b0c0ea76d27a453b0baf577c61633aee25cea93dcacec1630
Status: Downloaded newer image for node:9.5-alpine
---> e90a5bfd29f6
Step 2/10 : EXPOSE 8000
---> Running in eba84000a15c
Removing intermediate container eba84000a15c
---> ee5238c013d1
Step 3/10 : RUN apk update && apk add --update --repository http://dl-3.alpinelinux.org/alpine/edge/testing vips-tools vips-dev fftw-dev gcc g++ make libc6-compat && apk add git && apk add python && rm -rf /var/cache/apk/*
---> Running in ca25cdd3e5b3
fetch http://dl-cdn.alpinelinux.org/alpine/v3.6/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.6/community/x86_64/APKINDEX.tar.gz
v3.6.3-56-ge3af38305d [http://dl-cdn.alpinelinux.org/alpine/v3.6/main]
v3.6.3-50-g43dd52bda8 [http://dl-cdn.alpinelinux.org/alpine/v3.6/community]
OK: 8443 distinct packages available
fetch http://dl-3.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.6/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.6/community/x86_64/APKINDEX.tar.gz
WARNING: This apk-tools is OLD! Some packages might not function properly.
ERROR: unsatisfiable constraints:
pc:fftw3 (missing):
required by: vips-dev-8.7.0-r0[pc:fftw3]
vips-dev-8.7.0-r0[pc:fftw3]
vips-dev-8.7.0-r0[pc:fftw3]
The command '/bin/sh -c apk update && apk add --update --repository http://dl-3.alpinelinux.org/alpine/edge/testing vips-tools vips-dev fftw-dev gcc g++ make libc6-compat && apk add git && apk add python && rm -rf /var/cache/apk/*' returned a non-zero code: 2
Hi.. I've tried the example command and it worked nicely:
`docker run -it --rm -v $(pwd)/site:/site -p 8000:8000 aripalo/gatsby-docker develop``
But when I try to build my own GatsbyJS project:
docker run -it --rm -v $(pwd)/.:/site -p 8000:8000 aripalo/gatsby-docker develop
or build
it fails with an error:
Do you have any idea of what's happening? Basically I just wish to build a public folder ( using gatsby build ) with docker.
Thanks!
Is there a reason to use npm install instead of yarn install in entrypoint.sh? You use yarn in your example in the readme ... and I currently have an issue with npm producing an error while installing detect-port (which yarn doesn't).
Cheers
Uwe
I use exactly the same config, but it doesn't work.
docker build
was ok
but docker run
failed : /entry.sh: 41: exec: develop: not found
Can't build in corporate environments.
npm config set strict-ssl false
Hi @aripalo, this looks great!
I tried installing gatsby-plugin-sharp
, but it fails because it doesn't have all the tools available to build sharp
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#docker
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
Hi, I tried to run my gatsby project that uses gatsby-plugin-sharp
, I typed in:
docker run -it --rm -v $(pwd)/site:/site -p 8000:8000 aripalo/gatsby-docker develop
but I'm getting following error:
Error: Error loading shared library /site/node_modules/sharp/build/Release/sharp.node: Exec format error
Everything is working fine when I'm starting a new project without mentioned plugin. Does anyone know what I'm doing wrong?
Currently running the command in a clean repo results in this:
Command: docker run -it --rm -v $(pwd)/site:/site -p 8000:8000 aripalo/gatsby-docker develop
The first thought before any in-depth investigation is that it pulls latest version of eslint, yet sticks to a given version of node; eventually node version became outdated in regard to the eslint one and this triggered. Could be as simple as updating the dockerfile to point to more up-to-date packages.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.