Skip to content

Commit

Permalink
fix: share ENV vars between terminal and cron environment via ~/.env …
Browse files Browse the repository at this point in the history
…key/value pairs

# Due to the fact that cron process doesn't access to declared ENV vars and doesn't load user profiles
# The entrypoint.sh script stores ENV vars at runtime in the ~/.env file as key=value pairs
# Then the cron line include some command to load these ENV vars from file before launching app.py
# This mecanism allows to give access to the same ENV vars for app.py launch in terminal and launch via cron

# Conflicts:
#	docker-env/Dockerfile
  • Loading branch information
rv2931 committed Feb 25, 2024
1 parent c4da4ec commit 756447e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docker-env/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install -y
# The entrypoint.sh script stores ENV vars at runtime in the ~/.env file as key=value pairs
# Then the cron line include some command to load these ENV vars from file before launching app.py
# This mecanism allows to give access to the same ENV vars for app.py launch in terminal and launch via cron
RUN echo "*/15 * * * * root export \$(cat ~/.env | grep -v '#' | xargs);/venv/bin/python3 /source_code/app.py 2>&1 | /usr/bin/logger -t bloom" >> ./cron_scrapper
RUN echo "*/15 * * * * root export \$(cat ~/.env | grep -v "#" | xargs);/venv/bin/python3 ${APP_DIR}/app.py 2>&1 | /usr/bin/logger -t bloom" >> ./cron_scrapper
RUN chmod 744 ./cron_scrapper

# Move cron tab into the right directory
Expand Down

0 comments on commit 756447e

Please sign in to comment.