I've been working with Rails under Docker and generally I like it a lot. My current app uses Rails for the backend and most of the frontend, but one page also includes a React app, which requires the gulp build system and some other Node tooling. I have Rails in one container, but since I am only using Node to build my JS and CSS(I don't need it to run on the server), I split that out into its own container, based on the Node Docker image.
So, I build my assets with a one-off command to my node image (docker run --rm gulp_image npm run gulp production
), and then build my Rails image with the newly-built CSS and JS assets.
This works fine, but the only thing I don't like is that the Rails app image has this kind of implied dependency on the Node image. The Rails image will build, but it won't work unless I have previously run my client-side build on the Node image.
How should I handle this? Is there a way to make the Rails build fail if the gulp-built assets aren't present?