Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion command-runner/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ FROM ${RUNNER}:${TAG}

LABEL maintainer='Ameer A. <ameer.a@yamsafer.me>'

USER root

ENV STAGE 'development'
ENV NODE_ENV ${STAGE}

ENV APP_DIR '/opt/app'
ENV APP_DIR '/opt/app'
ENV APP_USER 'root'

ENV CRON_SPEC '* * * * *'
ENV CRON_EXEC ''
ENV EXEC_OPTS ''
Expand All @@ -25,4 +29,7 @@ ADD scripts .
RUN chmod +x *
RUN ./cron-installer.sh

USER ${APP_USER}
WORKDIR ${APP_DIR}

CMD [ "/opt/scripts/runner-cmd.sh" ]
2 changes: 1 addition & 1 deletion command-runner/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
RUNNER ?= node
BASE_TAG ?= latest

IMAGE_REPO ?= $(RUNNER)-runner
IMAGE_REPO ?= $(shell basename $(RUNNER))-runner
IMAGE_TAG ?= $(BASE_TAG)
NAMESPACE ?= yamsafer

Expand Down
1 change: 1 addition & 0 deletions command-runner/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Manages running our Node based CRON jobs.

`STAGE`: The stage of the running CRON, if it's not `prod` or `production` the command is run only once. Default value `development`.
`APP_DIR`: The directory inside the container to run the command in. Default value `/opt/app`.
`APP_USER`: The user inside the container to run the command in. Default value `root`.
`CRON_SPEC`: The schedule for the CRON, using the standard CRON notation. Default value `* * * * *`.
`CRON_EXEC`: The command to be executed on the schedule, it has to be provided otherwise an error is thrown when running the image.
`EXEC_OPTS`: Any addition options the command needs. Default value is empty.
4 changes: 2 additions & 2 deletions command-runner/scripts/cron-installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if [ $(which apt-get) ]; then
INSTALL_COMMAND='install'
INSTALL_OPTS='-y'

PACKAGES='cron'
PACKAGES='cron gawk'
elif [ $(which apk) ]; then
PACKAGE_MANAGER='apk'

Expand All @@ -27,7 +27,7 @@ elif [ $(which apk) ]; then
INSTALL_COMMAND='add'
INSTALL_OPTS=''

PACKAGES='dcron'
PACKAGES='dcron gawk'

ALP_CLR='-e'
else
Expand Down