I’m trying to figure out a way that I can get content (like static files) out of a container after it has been built by
The scope of
plugins/docker is to build and publish an image using docker-in-docker in a stateless manner. Since you are only building (and not publishing) and you want to maintain state, this plugin would not be appropriate for your use case. Note that you can always create a custom plugin that targets your use case but I’m not sure that is necessary here.
I effectively would like to build a multi-stage Dockerfile that builds the project and for example docs, and then extract the docs from the container image so it can be pushed to GitHub Pagers.
I suppose this can be done by running a Docker in Docker step after, but I was hope someone knew about a slightly more elegant method.
We have examples in our documentation for using docker-in-docker service containers but this feels like it adds a layer of complexity that may not be needed.
I would probably avoid using a Dockerfile and instead do something like this:
- name: build
- npm i -g gatsby
- npm i
- gatsby build
- gatsby build --prefix-paths