Skip to content

Commit

Permalink
Configure cronjob in Docker container
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-lerch committed May 11, 2020
1 parent 221c6f8 commit f77e293
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 3 deletions.
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM php:5.6-apache
RUN set -x \
# Install necessary packages
&& apt-get update \
&& apt-get install -y zip unzip less vim libc-client-dev libkrb5-dev libpng-dev libjpeg-dev \
&& apt-get install -y zip unzip less vim cron libc-client-dev libkrb5-dev libpng-dev libjpeg-dev \
&& rm -rf /var/lib/apt/list/* \
# Install PHP extensions
&& docker-php-ext-configure mysql \
Expand All @@ -13,7 +13,6 @@ RUN set -x \
&& docker-php-ext-configure gd --with-jpeg-dir=/usr/include \
&& docker-php-ext-install gd \
# Configure environment
&& echo "default_charset = ISO-8859-1" > /usr/local/etc/php/conf.d/docker-php-charset.ini \
&& a2enmod rewrite \
# Remove temporary packages
&& apt-get purge -y --autoremove libc-client-dev libkrb5-dev
Expand Down
1 change: 1 addition & 0 deletions install/default/docker/docker-php-charset.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
default_charset = ISO-8859-1
11 changes: 11 additions & 0 deletions install/default/docker/docker-php-entrypoint
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh
set -e

service cron start

# first arg is `-f` or `--some-option`
if [ "${1#-}" != "$1" ]; then
set -- apache2-foreground "$@"
fi

exec "$@"
1 change: 1 addition & 0 deletions install/default/docker/kool-scheduler
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*/5 * * * * www-data /usr/local/bin/php /var/www/html/scheduler.php
10 changes: 9 additions & 1 deletion install/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@
WEB_UID=www-data
WEB_GID=www-data

function setup_container() {
echo "Setting up container configuration..."
cp -f default/docker/docker-php-entrypoint /usr/local/bin
cp -f default/docker/docker-php-charset.ini /usr/local/etc/php/conf.d
cp -f default/docker/kool-scheduler /etc/cron.d
}

function dir_config() {
echo "Preparing ~/config..."
if [[ ! -d ../config ]]; then mkdir ../config; fi
Expand Down Expand Up @@ -80,6 +87,7 @@ function main() {
cd $(dirname $0)

if [[ $1 == "--docker-build" ]]; then
setup_container
dir_download
dir_latex
dir_templates_c
Expand All @@ -102,7 +110,7 @@ function main() {
fi

echo ""
echo "Setup finished. Navigate to http://kool.your.tld/install to continue with the webinstaller."
echo "Setup finished. Navigate to http://kool.your.tld/install/ to continue with the webinstaller."
echo ""
fi
}
Expand Down

0 comments on commit f77e293

Please sign in to comment.