Skip to content

Commit

Permalink
feat: Prevent cron docker entrypoint to run as non-root user
Browse files Browse the repository at this point in the history
  • Loading branch information
ambroisemaupate committed Sep 19, 2024
1 parent b927159 commit 2dc6c62
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docker/php-fpm-alpine/docker-cron-entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ set -e

env >> /etc/environment

# cron entrypoint must be run as root as it spawns crontab for each system user
if [ "$(id -u)" -ne 0 ]; then
echo "Please run as root"
exit 1
fi

# Print env infos
echo "APP_ENV=${APP_ENV}";
echo "APP_RUNTIME_ENV=${APP_RUNTIME_ENV}";
Expand Down
6 changes: 6 additions & 0 deletions docker/php-fpm-alpine/docker-cron-entrypoint-dev
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ set -e

env >> /etc/environment

# cron entrypoint must be run as root as it spawns crontab for each system user
if [ "$(id -u)" -ne 0 ]; then
echo "Please run as root"
exit 1
fi

# Print env infos
echo "APP_ENV=${APP_ENV}";
echo "APP_RUNTIME_ENV=${APP_RUNTIME_ENV}";
Expand Down

0 comments on commit 2dc6c62

Please sign in to comment.