Last active
May 26, 2020 18:10
-
-
Save cesartalves/69f6440b97c89e9dee6cfffbdf9b7790 to your computer and use it in GitHub Desktop.
Sidekiq image (crontab + whenever)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
service cron start | |
exec "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ruby:2.5.7 | |
RUN apt-get update && apt-get install -y cron | |
RUN apt-get install -y nano | |
COPY Gemfile* /usr/src/app/ | |
WORKDIR /usr/src/app | |
ENV BUNDLE_PATH /gems | |
# Adding an editor for crontab -e (visualizing crontab) | |
ENV EDITOR nano | |
RUN gem update bundler | |
RUN bundle install | |
COPY . /usr/src/app | |
RUN chmod +x ./docker-entrypoint.sh | |
# Using here because my schedule is empty. Can be ignored | |
RUN bundle exec wheneverize | |
RUN bundle exec whenever -w | |
ENTRYPOINT [ "./docker-entrypoint.sh" ] | |
# latest two configs are not necessary. | |
# You can just use CMD [ "bundle", "exec", "sidekiq"]. If there are any specific params | |
# to pass to sidekiq, you can do so like below | |
CMD [ "bundle", "exec", "sidekiq", "-r", "./config/boot.rb" ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment