File tree Expand file tree Collapse file tree 3 files changed +9
-16
lines changed
Expand file tree Collapse file tree 3 files changed +9
-16
lines changed Original file line number Diff line number Diff line change 1- # 10분마다 실행 (파일은 파이썬이 알아서 쓰고, 화면 출력은 도커 로그로 쏴줌 )
2- */10 * * * * cd /app && /usr/bin/python3 main.py >> /proc/1/fd/1 2>> /proc/1/fd/2
1+ # 10분마다 실행 (환경변수는 /app/.env에서 로드 )
2+ */10 * * * * . /app/.env && cd /app && /usr/bin/python3 main.py >> /proc/1/fd/1 2>> /proc/1/fd/2
Original file line number Diff line number Diff line change @@ -8,5 +8,6 @@ services:
88 env_file :
99 - /opt/crawler/.env
1010 volumes :
11+ - /opt/crawler/.env:/app/.env:ro
1112 - /opt/crawler/data:/app/data
1213 - /opt/crawler/logs:/app/logs
Original file line number Diff line number Diff line change 33
44STATE_FILE=" /app/data/crawler_state.json"
55REQUIRED_PLATFORM_KEYS=" ${REQUIRED_PLATFORM_KEYS:- MUSINSA} "
6- ENV_FILE=" /opt/crawler/.env"
7-
8- echo " [entrypoint] .env 로드..."
9- if [ -f " $ENV_FILE " ]; then
10- export $( grep -v ' ^#' " $ENV_FILE " | xargs)
11- fi
6+ AWS_REGION=" ${AWS_REGION:- ap-northeast-2} "
127
138echo " [entrypoint] Playwright Chromium 점검..."
149python -m playwright install chromium
@@ -45,15 +40,12 @@ if [ "$NEED_INITIAL_LOAD" = "true" ]; then
4540 python /app/initial_load.py
4641fi
4742
48- echo " [entrypoint] crontab 생성..."
49-
50- cat << EOF > /tmp/crontab_with_env
51- */10 * * * * . ${ENV_FILE} && cd /app && /usr/bin/python3 main.py >> /proc/1/fd/1 2>> /proc/1/fd/2
52- EOF
53-
54- cat /tmp/crontab_with_env
43+ echo " [entrypoint] crontab 등록..."
44+ crontab /app/crontab
5545
56- crontab /tmp/crontab_with_env
46+ echo " [DEBUG] 등록된 crontab:"
47+ crontab -l
48+ echo " ---"
5749
5850echo " [entrypoint] cron 시작..."
5951cron -f
You can’t perform that action at this time.
0 commit comments