-
Notifications
You must be signed in to change notification settings - Fork 22
Conditionally make assets... #4
Comments
That's pretty hacky though. |
Yeah, if it fails it should break building if you expect it to run. |
Right, so you need to grep the output and return true if there's no task and false if there is... Ugly. |
guys, I test this: ONBUILD RUN if [ -f /app/user/Rakefile ]; then bundle exec rake assets:precompile; fi and work for me. I tested using an simple script with Gemfile without rails or sinatra, only ruby |
@gwmoura I can see quite a few use-cases were an app would have a
|
@jmervine yes, can be, in my case, I execute a ruby script only, no Rails. Your solution not work for me :( |
@gwmoura Merging the two, you could do something like (untested):
|
@jmervine I tested your script and this worked fine for me. @hone if you want, you can add on Dockerfile. I tested locally, but I will add in my image based on Look my results: $ ls
app.rb docker-compose.yml Dockerfile Gemfile Gemfile.lock run.sh vendor
$ test -f Rakefile && (test "$(bundle exec rake -T | grep assets:precompile)" && bundle exec rake assets:precompile) And in a rails app too not work $ ls
app config db Gemfile.lock log Rakefile test vendor
bin config.ru Gemfile lib public README.rdoc tmp
$ test -f Rakefile && (test "$(bundle exec rake -T | grep assets:precompile)" && bundle exec rake assets:precompile)
I, [2015-10-01T18:41:24.746492 #2063] INFO -- : Writing /home/george/workspace/tests/ruby/railsblocks/myproject/public/assets/application-d4d603d0ff049a3ecfbf019b468bf1a62a50b9fdafe41213c300fa071342b600.js
I, [2015-10-01T18:41:24.749187 #2063] INFO -- : Writing /home/george/workspace/tests/ruby/railsblocks/myproject/public/assets/application-e80e8f2318043e8af94dddc2adad5a4f09739a8ebb323b3ab31cd71d45fd9113.css |
why cant we just remove the assets:precompile from this Docker file and have users add it if needed? |
even with the suggested fix it would not work for my team because we need to run |
@3den Perhaps add |
@jmervine thanks for the reply, what is the best way to do that? |
@3den My rake-fu is not super strong, but the first section here talks about how to build dependency tasks. You'll have to build a custom task for the Because Cheers! Edit: This talks about how to do exactly what we're talking about here. I didn't vet it, but it should be a good start. |
Not 100% sure this will work but I think it's...
The text was updated successfully, but these errors were encountered: