gatsbyjs / gatsby-docker

Docker image that builds and hosts a Gatsby site
MIT License
356 stars 88 forks source link

CLI / Dev image #25

Open polarathene opened 5 years ago

polarathene commented 5 years ago

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.

https://github.com/gatsbyjs/gatsby-docker/issues/11 https://github.com/gatsbyjs/gatsby-docker/issues/24

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.

gatsbot[bot] commented 5 years ago

Hiya!

This issue has gone quiet. Spooky quiet. πŸ‘»

We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here.

If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!

Thanks for being a part of the Gatsby community! πŸ’ͺπŸ’œ

kanolato commented 5 years ago

@polarathene I opened a PR #26 , maybe you could check it and help me improve the current Docker Image

cdaringe commented 4 years ago

Docker image that builds and hosts a Gatsby site

agreed with the above comments. the current doesnt build. the first step in the instructions conflictingly say "build your assets" then copy 'em in

polarathene commented 4 years ago

@cdaringe #26 was merged which updates the onbuild image to build the project and uses Debian Buster, so that should handle that purpose better.

A development image still needs to be supplied, although I imagine there is less demand for that, will keep this issue open if anyone wants to tackle that.

mattvonrocketstein commented 4 years ago

agree with OP, this image is not usable for any of the things everyone will expect it to be useful for.

$ docker run -it -v `pwd`:/workspace -w /workspace --entrypoint bash gatsbyjs/gatsby
bash-5.0# npm
bash: npm: command not found
bash-5.0# node
bash: node: command not found
bash-5.0# gatsby
bash: gatsby: command not found
TomFaulkner commented 4 years ago

Came here looking for a dev image. So, a bump for this issue. :)

polarathene commented 4 years ago

Technically, you could probably just use a nodejs docker image and mount a local data volume that has gatsby installed? Might want another volume for the package cache or configure npm/yarn to use a dir in the mounted volume. Wouldn't be too different to what you'd want from a dev image?

Buster is available now, so the outdated packages for things like webp issue isn't an issue anymore. Not sure if npm package linux support for image libs improved to handle Alpine or not, I'm assuming not.

TomFaulkner commented 4 years ago

I was looking for this after having problems getting Gatsby to install and work on a Ubuntu 20.04 distribution (Pop). I ended up using this and modifying the Dockerfile to use it to create a new site as well. https://www.stoutlabs.com/blog/2019-02-05-my-docker-setup-gatsby-next/

yukihiko-shinoda commented 3 years ago

I built docker image for Gatsby development and wrote procedure manual: futureys/gatsby - Docker Hub

If anyone wants to fork to customize, Dockerfile is here: yukihiko-shinoda/dockerfile-gatsby: Dockerfile for Gatsby.

I could develop Gatsby site with this image. Isn't this also be your helps? I'm searching response maybe I don't know the details of development in Gatsby since I'm first time to develop Gatsby site. And if Gatsby official have plan to maintain Docker image for Gatsby development, where should I submit these code?

polarathene commented 3 years ago

if Gatsby official have plan to maintain Docker image for Gatsby development,

I am not aware of official gatsby devs caring too much for the maintenance of Docker images here. They probably have no plans for such but wouldn't be against one being contributed here.

where should I submit these code?

This is the correct repo to submit a PR to, however it would need to pass review. I am a bit busy until sometime next month to properly evaluate your Docker image, I do recall alpine linux having a problem with some packages Gatsby uses, you have added gcc which should remedy that issue (imagemin packages I think).

You seem to add a bunch of packages for mozjpeg which is an optional package and shouldn't matter too much for a development image, what I do remember is those dependencies are for an older version of mozjpeg, if they're still relevant then the package providing mozjpeg is using an old version and not been updated, here's a docker image with alpine that builds mozjpeg.

There is an existing PR in this repo that had a good approach to a dev image, the entrypoint script made it useful. I believe back then vips wasn't available as a stable package and wasn't good to build, that's changed since.