gatsbyjs / gatsby-docker Goto Github PK
View Code? Open in Web Editor NEWDocker image that builds and hosts a Gatsby site
License: MIT License
Docker image that builds and hosts a Gatsby site
License: MIT License
It is confusing, that the Docker image with latest
does not represent the source of the master branch. Can someone build a new Docker image from HEAD? This is especially important, because there is a fix missing in there (c6671d4).
First time using gatsby-docker
it just crashes by following your readme. What am I missing here?
[+] Building 3.0s (9/10)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 527B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 34B 0.0s
=> [internal] load metadata for docker.io/gatsbyjs/gatsby:latest 2.9s
=> [internal] load metadata for docker.io/gatsbyjs/gatsby:onbuild 2.8s
=> [auth] gatsbyjs/gatsby:pull token for registry-1.docker.io 0.0s
=> [stage-1 1/2] FROM docker.io/gatsbyjs/gatsby@sha256:fa8b71211a1ae2d3a3f53c1a8c73cd6aa563b02e5c7d2e70975fed65e55af712 0.0s
=> => resolve docker.io/gatsbyjs/gatsby@sha256:fa8b71211a1ae2d3a3f53c1a8c73cd6aa563b02e5c7d2e70975fed65e55af712 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 2B 0.0s
=> CANCELED [build 1/1] FROM docker.io/gatsbyjs/gatsby:onbuild@sha256:cc6f390975708bee5b4dc9a2a4812b8e8bfb2ded1bb5c3107be91150e97ccb50 0.0s
=> => resolve docker.io/gatsbyjs/gatsby:onbuild@sha256:cc6f390975708bee5b4dc9a2a4812b8e8bfb2ded1bb5c3107be91150e97ccb50 0.0s
=> => sha256:cc6f390975708bee5b4dc9a2a4812b8e8bfb2ded1bb5c3107be91150e97ccb50 947B / 947B 0.0s
=> => sha256:d584dc12fdde1770d771137dfecff12d53ae522fadd6ae7915c08864d6401dd7 3.32kB / 3.32kB 0.0s
=> ERROR [build 2/1] ADD public/ /pub``
`
Hello friends.
This docker image is not enough anymore to run a Gatsby 4 site, since it does not allow for the Render modes. It should gatsby serve
, not only nginx the public
folder.
Or even better, there would be a docker image that uses web workers similar to Gatsby Cloud.
What would be the future for Gatsby-docker?
I'm on Windows and really like the idea of using docker to get around all the different OS idiosyncrasies. Is this up to date?
This looks like it's just an nginx container? I'm trying to get a Docker container that works with v2 of Gatsby.
I have been using this container but it's a bit outdated. I ran into some issues but since it's running Gatsby v1.9.x and not ^2.0.0, I can't be sure that it's not already been fixed(afaik v2 introduced quite a few changes).
#11 (Gatsby CLI so it can be used for development) has been in discussion for a while and there is a PR that recently got some feedback but it's not clear if that'll be sussed out any time soon. So in the meantime I went to the PR repo and copied their Dockerfile, like I had tried with the prior one I had been using, but attempting to build both fails because of vips-dev requiring fttw3?
I'm going to give up on an alpine build as I've spent over 8 hours trying different Dockerfile changes to resolve the issue and get a working build but can't seem to get a container with v2 working :\
client_max_body_size is currently set to 64kb https://github.com/gatsbyjs/gatsby-docker/blob/master/nginx-boot.sh#L67 and there is no way to customize it
A simple env variable would make it easier to customize this configuration
The updated gatsby-plugin-image
plugin generated webp images. Those are currently not cached by the user browser because of the missing nginx configuration
Image doesn't actually provide Gatsby in a way that can be used for development via Docker.
@gatsbybot has closed two similar issues. It's a bit broken as it closes issues regardless of activity and states you can re-open the issue, but the issue author is not able to actually do so.
Should be noted that alpine isn't a good candidate for dev image at present. Numerous issues detailed in the related PR. Official node images have debian stretch slim available, it should work alright despite having packages a fair bit outdated(2015), Buster will arrive later this year. Official node images are also considering adding Ubuntu as a base option too.
Running this command:
docker run -d --rm myproject/website .
exposes no site on localhost...
but
docker run -d -p 80:80 --rm myproject/website .
does.
Am I just being clueless about how Docker works?
I have a working gatsbyjs project that doesn't run from the official Docker image.
This is the Dockerfile (based on a related issue.
FROM gatsbyjs/gatsby:latest
ADD public/ /pub
(the compiled website is at public/ and I've confirmed the index.html renders the website correctly)
I also tried the official Dockerfile, which didn't work:
FROM gatsbyjs/gatsby:onbuild
I'm running this from docker-compose as follows:
version: '3'
services:
website:
build: .
ports:
- "80:80"
Nginx returns a "500 Internal Server Error".
I'm following the official tutorial here.
This is also submitted as a StackOverflow question here.
Tried to pull image and I'm getting this error,
will creating a login at docker hub fix this or do i need further permissions
thank you in advanced
''Unable to find image 'gatsby:latest' locally
ddocker: Error response from daemon: pull access denied for gatsby, repository does not exist or may require 'docker login'.''
Hi!
Nice project.
I recently run the image and this is the error.
docker run --rm gatsbyjs/gatsby /sbin/nginx-boot: line 83: syntax error near unexpected token
then'
/sbin/nginx-boot: line 83: if [ "" != "$DEBUG" ]; then'
Opening the file with:
docker run --rm -it gatsbyjs/gatsby vi /sbin/nginx-boot
I saw that there are .. in between the if and [.
Using cat I can't see that.
After modify that the error is:
bash-4.3# nginx-boot nginx: [emerg] open() "/run/nginx/nginx.pid" failed (2: No such file or directory)
If I create the /run/nginx directory, nginx works, but not yet gatsby.
Possibly related to #13
Running docker run -d -p 80:80 --rm myproject/website .
, and then visiting localhost, leads me to a page with "500 Internal Server Error / nginx"
Docs say:
Insert the Dockerfile above at the root of your project
Above (repository contents) are two Dockerfiles, below is one line of a Dockerfile.
Creating an image using nginx-boot.sh as directed does not work if you are using port redirection in docker.
Procedure to reproduce:
docker build -t test-gatsby .
docker run --name k8s-test -d -p 8001:80 test-gatsby:latest
If I follow the documentation, I create a Dockerfile containing:
FROM gatsbyjs/gatsby:onbuild
RUN gatsby build
This will will output:
Sending build context to Docker daemon 198.1MB
Step 1/2 : FROM gatsbyjs/gatsby:onbuild
# Executing 1 build trigger
---> e5cc71f754ba
Step 2/2 : RUN gatsby build
---> Running in 18b3c4f0d471
/bin/sh: gatsby: not found
The command '/bin/sh -c gatsby build' returned a non-zero code: 127
what am I doing wrong? How to set up a correct Dockerfile for building?
Looking at the README I see that I can run the app on an HTTP port. How is it suggested that I use HTTPS instead?
It would be really helpful if there was a Gatsby CLI image, similar to something like the Composer image.
That way you can use the CLI image to build the site in a multi-stage build.
I am getting the following error
Sending build context to Docker daemon 1.384MB
Step 1/3 : FROM gatsbyjs/gatsby:onbuild as build
# Executing 1 build trigger
ADD failed: stat /var/lib/docker/tmp/docker-builder611750273/public: no such file or directory
Hello.
After debugging why my gatsby project doesn't build with these instructions I found out that docker hub has not been updated with the latest image.
Last Travis job #24 was run two months ago.
as per gatsby caching guidelines https://www.gatsbyjs.org/docs/caching/ can we add cache-control: public, max-age=0, must-revalidate
to page-data.json files
if i start from index page and then move in to other pages it works but if i refresh in other page then homepage so like request is /app/login
it returns 404
Let's use a Map as they're a lot cheaper when arrays get large
Originally posted by @KyleAMathews in gatsbyjs/gatsby#36135 (comment)
as the configuration file is set now, it is impossible to http add headers because the hardcoded location directives precede the customization part. I propose to put the custom environment variable $CUSTOM_SERVER_CONFIG
before the location sections.
I have found some typos in the readme file of this repo.
I am opening this issue to link a PR later.
I am a beginner. Please accept my naive contribution. Thanks.
I'm curious why the Dockerfile is not starting with FROM nginx:alpine
Hi, I have some questions about the default cache control.
The default en variables indicat that all js files will be cached public and expire 1 year. But gatsby doc suggest sw.js shoud be uncachable:
The only exception to this is the file /sw.js, which needs to be revalidated upon each load to check if a new version of the site is available. This file is generated by gatsby-plugin-offline and other service worker plugins, in order to serve content offline. Its cache-control header should be cache-control: public, max-age=0, must-revalidate1
And the doc also says json files should be uncachable too:
Similar to HTML files, the JSON files in the public/page-data/ directory should never be cached by the browser.
How can I achieve this? I try the following, but didn't work:
- CACHE_IGNORE=html|page-data\.json|sw\.js
- CACHE_IGNORE=html|page-data.json|sw.js
If just use json, the json files work, but how to specify sw.js?
- CACHE_IGNORE=html|json|sw.js
Thanks!
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.