fly-apps / dockerfile-node

Dockerfile generator for Node.js
154 stars 5 forks source link

Support adding instructions at the start of the stage #50

Open nahtnam opened 10 months ago

nahtnam commented 10 months ago

Use case: I'd like to add certain files before running the build or install.

rubys commented 10 months ago

I have an analogous feature in dockerfile-rails: https://github.com/fly-apps/dockerfile-rails#advanced-customization (`--instructions), which would be relatively straightforward to port to this package.

More precise feedback on where exactly the instructions would be placed would be helpful. You can look at the dockerfile rails template to get an idea of what is implemented there:

Would this work for you?

nahtnam commented 10 months ago

Hmm so this use case was copying the .yarn folder (contains plugins) which needs to be copied before the yarn install command. I ended up ejecting because it was a bit too hard to maintain and also we went with Next.js's "standalone mode"

rubys commented 10 months ago

That use case seems common enough that it shouldn't require additional instructions. See this from dockerfile-rails:

https://github.com/fly-apps/dockerfile-rails/blob/b348b6962b928f64803ce0c3260c6eb98f5a8cb0/lib/generators/templates/_npm_install.erb#L3-L5

I assume that you have a .yarnrc? And what directories should be copied from the .yarn directory?