diff --git a/Dockerfile b/Dockerfile index cc297b3..f3d8b1a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,6 +16,8 @@ RUN apt-get update \ && rm -f /etc/cron.d/* \ # Install plugin dependencies \ && bundle check || bundle install \ - && chmod +x /pre-entrypoint.sh - -ENTRYPOINT ["/pre-entrypoint.sh"] \ No newline at end of file + && chmod +x /pre-entrypoint.sh \ + # setting ENTRYPOINT destroys CMD so replace the entrypoint script and call it later \ + # (see bottom note in https://docs.docker.com/engine/reference/builder/#entrypoint) \ + && mv /docker-entrypoint.sh /orig-entrypoint.sh \ + && mv /pre-entrypoint.sh /docker-entrypoint.sh diff --git a/pre-entrypoint.sh b/pre-entrypoint.sh index a800841..5358084 100644 --- a/pre-entrypoint.sh +++ b/pre-entrypoint.sh @@ -5,13 +5,13 @@ echo "Pre-start $@" echo "Pre-start $1 $2 $3" echo "Creating CRON entry for rake redmine:send_reminders" -echo "$REDMINE_SEND_REMINDERS_CRON_EXPR root cd /usr/src/redmine && rake redmine:send_reminders days=$REDMINE_SEND_REMINDERS_DAYS RAILS_ENV=production" > /etc/cron.d/redmine +echo "$REDMINE_SEND_REMINDERS_CRON_EXPR redmine GEM_HOME=/usr/local/bundle BUNDLE_APP_CONFIG=/usr/local/bundle /usr/local/bin/rake -f /usr/src/redmine/Rakefile redmine:send_reminders days=$REDMINE_SEND_REMINDERS_DAYS RAILS_ENV=production" > /etc/cron.d/redmine chmod 0644 /etc/cron.d/redmine crontab /etc/cron.d/redmine echo Starting CRON service cron start -set -- /docker-entrypoint.sh "$@" +set -- /orig-entrypoint.sh "$@" echo Executing original Redmine "$@" exec "$@" \ No newline at end of file