Run Cron jobs inside Docker container

This Dockerfile can be used to execute python code, scheduled by a Cron job.

The basic steps followed, load a random python application which is executed from the index.py file.
Make sure cron is installed in the image, load environment variables into a env file, specifically created to load the environment variables (restrict unix permissions) needed by the python app, availabe to os.environ().
The python app start command is written into an executable file script.sh, whose execution will be finally scheduled by cron.

The BASH_ENV environment variable can be used to preload environment variables at the cronjob context.

Environment varaibles loaded with BASH_ENV are only available to the cron job loading the BASH_ENV variable. In fact, entries in the crontab won’t share the same cron job context.