Skip to content

Instantly share code, notes, and snippets.

@cesartalves
Last active May 26, 2020 18:10
Show Gist options
  • Save cesartalves/69f6440b97c89e9dee6cfffbdf9b7790 to your computer and use it in GitHub Desktop.
Save cesartalves/69f6440b97c89e9dee6cfffbdf9b7790 to your computer and use it in GitHub Desktop.
Sidekiq image (crontab + whenever)
#!/bin/sh
set -e
service cron start
exec "$@"
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