.env를 crontab에서 인식하지 못하는 문제 수정
This commit is contained in:
48
build/app/Dockerfile
Normal file
48
build/app/Dockerfile
Normal file
@ -0,0 +1,48 @@
|
||||
FROM ubuntu:22.04
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive \
|
||||
LANG=ko_KR.UTF-8 \
|
||||
LANGUAGE=ko_KR:ko \
|
||||
LC_ALL=ko_KR.UTF-8
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
locales tzdata bash python3 python3-pip cron curl unzip wget gnupg ca-certificates \
|
||||
xvfb x11-utils libglib2.0-0 libnss3 libgconf-2-4 libfontconfig1 \
|
||||
libxss1 libxshmfence1 libasound2 libxtst6 libappindicator3-1 \
|
||||
fonts-nanum libu2f-udev && \
|
||||
locale-gen ko_KR.UTF-8 && \
|
||||
ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime && \
|
||||
dpkg-reconfigure --frontend noninteractive tzdata && \
|
||||
ln -sf /usr/bin/python3 /usr/bin/python && \
|
||||
curl -fsSL https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -o chrome.deb && \
|
||||
apt-get install -y ./chrome.deb && rm chrome.deb && \
|
||||
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
# Python 패키지 설치
|
||||
RUN pip install --no-cache-dir --upgrade pip && \
|
||||
pip install --no-cache-dir \
|
||||
selenium>=4.10 \
|
||||
pymysql \
|
||||
ftputil \
|
||||
pillow \
|
||||
pyvirtualdisplay \
|
||||
requests \
|
||||
python-dotenv
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN fc-cache -f -v
|
||||
|
||||
COPY app/ /app/
|
||||
|
||||
# 로그 디렉토리 생성
|
||||
RUN mkdir -p /logs && chmod 777 /logs
|
||||
|
||||
# Crontab 설정: 매일 09:00에 절대 경로로 Python 실행
|
||||
# cron은 컨테이너의 환경 변수를 상속받으므로 env_file로 주입된 변수들을 사용 가능
|
||||
RUN echo "0 9 * * * /usr/bin/python /app/gnu_autoupload.py >> /logs/cron.log 2>&1" | crontab - && \
|
||||
chmod 666 /logs
|
||||
|
||||
# Cron을 포그라운드에서 실행 (docker logs에 출력되도록)
|
||||
CMD ["/usr/sbin/cron", "-f"]
|
||||
Reference in New Issue
Block a user