I am using a separate nodejs container as in How to use a separate node container in your ddev setup?, but I'd really like to add the gatsby-cli npm package to it, and maybe add sudo as well. I know how to add a custom Dockerfile to the web service and do these things but how can I do it with a custom service?
How can I add gatsby-cli or sudo or other packages to a DDEV-Local add-on service like nodejs?
192 views Asked by rfay At
1
You can do the same things ddev does to add a custom Dockerfile, and add a
build
stanza and a.ddev/<servicename>-build
directory with the needed files.So for a .ddev/docker-compose.node.yaml file:
And then
mkdir .ddev/node-build
and create .ddev/node-build/Dockerfile withand .ddev/node-build/sudoers.d/ddev with
The result in this case is you get gatsby-cli installed via npm, and also get bash and passwordless sudo installed. This is just an example, there is plenty more that can be done, of course.
This saves the trouble of creating and maintaining a custom Docker image and pushing it up to hub.docker.com.