Cronjob added inside container
This commit is contained in:
17
Dockerfile
17
Dockerfile
@@ -1,4 +1,4 @@
|
||||
FROM ruby:2.7
|
||||
FROM ruby:3.1
|
||||
|
||||
ENV BUILD_PACKAGES="apt-utils build-essential curl less nodejs sudo wget zsh libmariadb-dev libserialport-dev cron"
|
||||
|
||||
@@ -14,7 +14,18 @@ COPY Gemfile Gemfile.lock ./
|
||||
RUN \
|
||||
apt-get update -qq && \
|
||||
apt-get install -y $BUILD_PACKAGES && \
|
||||
bundle install
|
||||
# Fix bundler version BEFORE bundle install
|
||||
gem install bundler -v "$(grep -A 1 'BUNDLED WITH' Gemfile.lock | tail -n 1)" && \
|
||||
bundle install && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy cron file (if you use /etc/cron.d style)
|
||||
COPY reportcron /etc/cron.d/reportcron
|
||||
RUN chmod 0644 /etc/cron.d/reportcron && touch /var/log/cron.log
|
||||
|
||||
# Add entrypoint script
|
||||
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
|
||||
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|
||||
|
||||
CMD ["/bin/bash -c ruby ./smartmeter.rb"]
|
||||
|
||||
Reference in New Issue
Block a user