Skip to content

Commit 2df4fba

Browse files
authored
Merge pull request #22 from rtucek/add-cron
Add cron
2 parents 3cc5b84 + 384e7d7 commit 2df4fba

File tree

4 files changed

+26
-2
lines changed

4 files changed

+26
-2
lines changed

Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ RUN \
1616
# Install tools, required for building
1717
apt-get update && \
1818
apt-get install -y --no-install-recommends \
19-
# In general...
19+
# For building (will be removed)
2020
autoconf \
2121
build-essential \
2222
curl \
@@ -43,7 +43,10 @@ RUN \
4343
# For Honcho
4444
python \
4545
python-pip \
46-
python-pkg-resources && \
46+
python-pkg-resources \
47+
48+
# Fron crontab
49+
cron && \
4750

4851
pip install honcho && \
4952

Procfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
nginx: /usr/local/sbin/nginx
22
phpfpm: /usr/local/sbin/php-fpm
3+
cron: /usr/sbin/cron -f

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,18 @@ Xdebug was installed mainly with the idea of providing code coverage for PHPUnit
5151
configured for any specific use case. You can [configure Xdebug](https://xdebug.org/docs/all) via
5252
`php.ini` if desired.
5353

54+
### Crontab
55+
56+
Crontab is already installed. In order to deploy a crontab file, you would need
57+
to store a valid crontab file to `/crontab/USERNAME`, where `USERNAME` has to
58+
be an **existing** user. This is important, because any contrab instructions
59+
will be executed as the user, specified by the filename.
60+
61+
Usually, you would like to run all your crontab instructions as **www-data**.
62+
So you should mount your crontab file to `/crontab/www-data` (or under
63+
`/crontab/root` if needed - needless to say you should try to avoid this
64+
whenever possible).
65+
5466
### Honcho
5567

5668
If you want to overwrite the default Honcho configuration - mount your custom `Procfile` file at `/`.

docker-entrypoint

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ if [[ $ENABLE_XDEBUG == "1" ]]; then
2828
echo -e "\e[32mXdebug enabled\e[0m"
2929
fi
3030

31+
# Deploy available crontabs
32+
if [[ -d /crontab ]]; then
33+
for crontab_file in $(ls /crontab); do
34+
crontab -u $crontab_file /crontab/$crontab_file
35+
done
36+
fi
37+
38+
# Start Honcho
3139
if [[ $1 == "server" ]]; then
3240
exec honcho -d / start
3341
fi

0 commit comments

Comments
 (0)