0

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?

David Ham
  • 833
  • 3
  • 12
  • 27

1 Answers1

0

Sounds like you want to do the opposite of this question Dockerfile build - possible to ignore error? If you make a shell script that returns an error code other than 0 when the files aren't found, it should fail the build.

Community
  • 1
  • 1
Roman
  • 19,581
  • 6
  • 68
  • 84