Table of Contents

About

As mentioned on the fat cron container for Docker page, there is no real equivalent for a cron-like mechanism that would make sense in the Docker or Docker swarm world, such that some software like cronicle seems to be the best replacement. However, whilst the original Dockerfile from Su Yang is just for the barebones "cronicle" software, the Dockerfile provided on this page is a re-write in order to use Debian as the base image, which allows adding the software that is necessary to run various tasks.

Usage

Checkout the source from the Subversion repository by issuing:

svn co https://svn.grimore.org/docker/build/cronicle

Change into the downloaded cronicle directory and execute:

docker build -t myregistry:5000/cronicle:latest .

where:

After the image has finished building, the image can be pushed onto the registry:

docker push myregistry:5000/cronicle:latest

The final step is to run the container and for that a compose file is provided.

Source

FROM debian:latest
 
# Install cron and required utilities.
RUN apt-get update
RUN apt-get -y install \
  bc \
  build-essential \
  cron \
  cron-daemon-common \
  curl \
  ffmpeg \
  gawk \
  git \
  gnupg \
  grep \
  joe \
  jq \
  less \
  openssl \
  pipx \
  procps \
  python3 \
  python3-pip \
  rclone \
  rsyslog \
  sed \
  sqlite3 \
  subversion \
  supervisor \
  wget \
  unzip 
 
# Install node-js
RUN curl -fsSL https://deb.nodesource.com/setup_current.x | bash - && \
    apt-get install -y nodejs && \
    node --version && npm --version
 
# Build cronicle-edge
WORKDIR /tmp
RUN git clone https://github.com/cronicle-edge/cronicle-edge && \
    cd cronicle-edge && \
    ./bundle /opt/cronicle --sqlite --tools && \
    rm -rf /tmp/chronicle-edge
 
# non root user for shell plugin
ARG CRONICLE_UID=1000
#1099
ARG CRONICLE_GID=1000
RUN addgroup cronicle --gid $CRONICLE_GID && \
    adduser --disabled-password --disabled-login --home /opt/cronicle --uid $CRONICLE_UID --gid $CRONICLE_GID cronicle
 
# this is dockeeerrrr!!
RUN usermod -o -g 1000 -u 1000 cronicle
 
###########################################################################
# BEGIN TOOLS                                                             #
###########################################################################
RUN mkdir -p /tmp/kitchen
WORKDIR /tmp/kitchen
 
# Install selenium for web automation.
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
    echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list && \
    apt-get update && apt-get -y install google-chrome-stable
 
RUN CHROMEDRIVER_FORCE_DOWNLOAD=true npm install -g selenium-side-runner chromedriver
 
# Install phantomJS
RUN curl -L -s https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 -o /tmp/kitchen/phantomjs-2.1.1-linux-x86_64.tar.bz2 && \
    tar -jxpvf phantomjs-2.1.1-linux-x86_64.tar.bz2 && \
    mkdir -p /usr/local/bin && \
    cp phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin/ && \
    rm -rf /tmp/kitchen/phantomjs*
 
# Install xidel
RUN curl -L -s https://sourceforge.net/projects/videlibri/files/Xidel/Xidel%200.9.8/xidel_0.9.8-1_amd64.deb/download -o /tmp/kitchen/xidel.deb && \
    apt-get install -f -y /tmp/kitchen/xidel.deb && \
    rm /tmp/kitchen/xidel.deb
 
# Install YouTube downloader.
RUN mkdir -p /opt/pipx && \
    export PIPX_HOME=/opt/pipx && \
    export PIPX_BIN_DIR=/usr/local/bin && \
    pipx install yt-dlp
 
# HDHomeRun
RUN git clone https://github.com/Silicondust/libhdhomerun.git /tmp/kitchen/libhdhomerun && \
    cd /tmp/kitchen/libhdhomerun && \
    make && \
    cp hdhomerun_config /usr/local/bin/ && \
    cp libhdhomerun.so /usr/local/lib/
 
# rclone
RUN curl -L -s https://downloads.rclone.org/v1.69.1/rclone-v1.69.1-linux-amd64.zip -o /tmp/kitchen/rclone-v1.69.1-linux-amd64.zip && \
    unzip rclone-v1.69.1-linux-amd64.zip && \
    cp rclone-v1.69.1-linux-amd64/rclone /usr/local/bin && \
    chmod +x /usr/local/bin/rclone
 
# remove kitchen
RUN rm -rf /tmp/kitchen
WORKDIR /
 
###########################################################################
# END TOOLS                                                               #
###########################################################################
 
WORKDIR /opt/cronicle
ENV PATH "/opt/cronicle/bin:${PATH}"
ENV CRONICLE_foreground=1
ENV CRONICLE_echo=1
ENV TZ=Etc/UTC
 
# add filesystem requirements
ADD rootfs /
 
#CMD ["/opt/cronicle/bin/manager"]
ENTRYPOINT [ "supervisord", "-t", "-n", "-c", "/etc/supervisor.conf" ]