Set BUNDLE_APP_CONFIG and DATABASE_URL in crontab when defined

This commit is contained in:
Patrick Gansterer 2017-08-08 23:19:39 +02:00
parent 3010dd2d90
commit 2c180cc9e8
2 changed files with 14 additions and 1 deletions

View File

@ -19,7 +19,7 @@ RUN buildDeps='libmagic-dev' && \
apt-get purge -y --auto-remove $buildDeps && \
mkdir -p log && \
ln -sfn /dev/stdout log/production.log && \
whenever --update-crontab
bundle exec whenever --update-crontab
# Add a temporary mysql-server for assets precompilation
RUN export DATABASE_URL=mysql2://localhost/temp && \

View File

@ -1,6 +1,19 @@
#!/bin/sh
set -e
CRONTAB="$(crontab -l)"
CRONTAB_ENV=""
if test -n "$BUNDLE_APP_CONFIG"; then
CRONTAB_ENV="${CRONTAB_ENV}BUNDLE_APP_CONFIG=$BUNDLE_APP_CONFIG\n"
fi
if test -n "$DATABASE_URL"; then
CRONTAB_ENV="${CRONTAB_ENV}DATABASE_URL=$DATABASE_URL\n"
fi
echo "$CRONTAB_ENV$CRONTAB" | crontab -
if [ -f tmp/pids/server.pid ]; then
rm tmp/pids/server.pid
fi