컨테이너 구동용 파일 추가
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
FROM ubuntu:22.04
|
FROM python:3.10-slim
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
# 작업 디렉토리 설정
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
# 시스템 패키지 설치
|
# 시스템 패키지 설치
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
@ -11,7 +12,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||||||
libffi-dev \
|
libffi-dev \
|
||||||
libbz2-dev \
|
libbz2-dev \
|
||||||
libreadline-dev \
|
libreadline-dev \
|
||||||
libsqlite3-dev \
|
|
||||||
libncurses5-dev \
|
libncurses5-dev \
|
||||||
libgdbm-dev \
|
libgdbm-dev \
|
||||||
liblzma-dev \
|
liblzma-dev \
|
||||||
@ -22,40 +22,26 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||||||
curl \
|
curl \
|
||||||
unzip \
|
unzip \
|
||||||
git \
|
git \
|
||||||
|
cron \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# 작업 디렉토리
|
# requirements 설치
|
||||||
WORKDIR /app
|
COPY requirements.txt ./
|
||||||
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
# 애플리케이션 소스 복사
|
# 앱 전체 복사
|
||||||
COPY ../app ./app
|
COPY . .
|
||||||
COPY ../conf ./conf
|
|
||||||
COPY ../lib ./lib
|
|
||||||
COPY ../data ./data
|
|
||||||
COPY requirements.txt .
|
|
||||||
|
|
||||||
# tkcalendar, customtkinter GUI 라이브러리 의존성
|
# 환경 변수 설정
|
||||||
RUN pip install --no-cache-dir \
|
ENV PYTHONUNBUFFERED=1
|
||||||
tkcalendar \
|
|
||||||
customtkinter
|
|
||||||
|
|
||||||
# pip 패키지 설치 (필요한 모든 모듈 명시)
|
# 크론 작업 등록: 매일 11시에 daily_run.py 실행
|
||||||
RUN pip install --no-cache-dir \
|
RUN echo "0 11 * * * python /app/daily_run.py >> /var/log/cron.log 2>&1" > /etc/cron.d/daily-cron \
|
||||||
sqlalchemy \
|
&& chmod 0644 /etc/cron.d/daily-cron \
|
||||||
pandas \
|
&& crontab /etc/cron.d/daily-cron
|
||||||
prophet \
|
|
||||||
statsmodels \
|
|
||||||
scikit-learn \
|
|
||||||
numpy \
|
|
||||||
requests \
|
|
||||||
pyyaml \
|
|
||||||
google-analytics-data \
|
|
||||||
lxml \
|
|
||||||
mysql-connector-python \
|
|
||||||
pymysql
|
|
||||||
|
|
||||||
# 포트 오픈
|
# 로그 파일 생성
|
||||||
EXPOSE 5000
|
RUN touch /var/log/cron.log
|
||||||
|
|
||||||
# 기본 실행 명령
|
# 컨테이너 시작 시 cron 실행 + file_watch.py 실행 + 로그 출력 유지
|
||||||
CMD ["python3", "app/app.py"]
|
CMD cron && python lib/file_watch.py & tail -f /var/log/cron.log
|
||||||
|
|||||||
13
docker-compose.yml
Normal file
13
docker-compose.yml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
services:
|
||||||
|
fg-static:
|
||||||
|
container_name: fg-static
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: build/Dockerfile
|
||||||
|
image: reg.firstgarden.co.kr/fg-static:latest
|
||||||
|
volumes:
|
||||||
|
- ./data:/app/data
|
||||||
|
- ./conf:/app/conf
|
||||||
|
environment:
|
||||||
|
- TZ=Asia/Seoul
|
||||||
|
restart: unless-stopped
|
||||||
Reference in New Issue
Block a user