I am trying to run a cronjob inside a docker container that invokes a shell script.
Yesterday I have been searching all over the web and stack overflow, but I could
Try using clockwork gem to schedule tasks. Follow the steps provided in this link.
http://fuzzyblog.io/blog/rails/2017/05/11/adding-cron-to-a-dockerized-rails-application-using-clockwork.html
You can call the rake task inside lib/clock.rb file as below.
every(1.day, 'Import large data from csv files', :at => '5:00') do |job|
`rake 'portal:import_data_from_csv'`
end
Create a separate container in docker-compose file & run the below command inside the container.
command: bundle exec clockwork lib/clock.rb