refactor: move Docker build files to build/ directory

This commit is contained in:
2025-12-31 11:26:54 +09:00
parent 24939ab7a7
commit 8cfeaae92d
5 changed files with 3 additions and 3 deletions

55
build/.dockerignore Normal file
View File

@ -0,0 +1,55 @@
# Git
.git
.gitignore
# Python
__pycache__
*.py[cod]
*$py.class
*.so
.Python
*.egg-info
.eggs
*.egg
.pytest_cache
.coverage
htmlcov
# 가상환경
venv/
.venv/
ENV/
env/
# IDE
.idea/
.vscode/
*.swp
*.swo
# 로그 및 데이터 (컨테이너에서 볼륨으로 마운트)
logs/
data/
*.log
# 환경 파일 (docker-compose에서 env_file로 마운트)
.env
# 임시 파일
tmp/
temp/
*.tmp
*.bak
# Docker 관련
Dockerfile
docker-compose*.yml
.dockerignore
# 문서
*.md
!README.md
# 기타
*.sqlite
*.db

72
build/Dockerfile Normal file
View File

@ -0,0 +1,72 @@
# ###################################################################
# Dockerfile - FGTools
# ###################################################################
# 퍼스트가든 통합 도구 Docker 이미지
# ###################################################################
FROM python:3.11-slim
LABEL maintainer="dev@firstgarden.co.kr"
LABEL description="FGTools - First Garden 통합 도구"
# 환경변수 설정
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PYTHONIOENCODING=utf-8
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
ENV TZ=Asia/Seoul
# 작업 디렉토리 설정
WORKDIR /app
# 시스템 패키지 설치 (vim + 한글 지원 + 타임존)
RUN apt-get update && apt-get install -y --no-install-recommends \
vim \
locales \
tzdata \
curl \
&& rm -rf /var/lib/apt/lists/* \
&& ln -snf /usr/share/zoneinfo/$TZ /etc/localtime \
&& echo $TZ > /etc/timezone
# 한글 로케일 설정
RUN sed -i '/ko_KR.UTF-8/s/^# //g' /etc/locale.gen && \
locale-gen ko_KR.UTF-8
ENV LANG=ko_KR.UTF-8
ENV LC_ALL=ko_KR.UTF-8
# vim 설정 (visual mode 비활성화 + 한글 지원)
RUN echo 'set mouse-=a' >> /etc/vim/vimrc.local && \
echo 'set encoding=utf-8' >> /etc/vim/vimrc.local && \
echo 'set fileencodings=utf-8,cp949,euc-kr' >> /etc/vim/vimrc.local && \
echo 'set termencoding=utf-8' >> /etc/vim/vimrc.local
# Python 의존성 설치
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt && \
pip install --no-cache-dir gunicorn
# 애플리케이션 코드 복사
COPY core/ ./core/
COPY services/ ./services/
COPY apps/ ./apps/
COPY *.py ./
# 로그 및 데이터 디렉토리 생성
RUN mkdir -p /app/logs /app/data /app/conf
# 헬스체크
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:${FLASK_PORT:-5000}/api/dashboard/health || exit 1
# 기본 포트 노출
EXPOSE 5000 5001 5002
# 엔트리포인트
COPY build/docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["dashboard"]

View File

@ -0,0 +1,52 @@
#!/bin/bash
# ###################################################################
# docker-entrypoint.sh - FGTools 컨테이너 시작 스크립트
# ###################################################################
set -e
# PYTHONPATH 설정
export PYTHONPATH=/app:$PYTHONPATH
# 서비스별 실행
case "$1" in
dashboard)
echo "[FGTools] Starting Dashboard API on port ${FLASK_PORT:-5000}..."
exec gunicorn \
--bind 0.0.0.0:${FLASK_PORT:-5000} \
--workers ${GUNICORN_WORKERS:-2} \
--timeout 120 \
--access-logfile - \
--error-logfile - \
"apps.dashboard.app:create_app()"
;;
weather)
echo "[FGTools] Starting Weather API on port ${FLASK_PORT:-5001}..."
exec gunicorn \
--bind 0.0.0.0:${FLASK_PORT:-5001} \
--workers ${GUNICORN_WORKERS:-2} \
--timeout 120 \
--access-logfile - \
--error-logfile - \
"apps.weather_api.app:create_app()"
;;
webhook)
echo "[FGTools] Starting Webhook Server on port ${FLASK_PORT:-5002}..."
exec gunicorn \
--bind 0.0.0.0:${FLASK_PORT:-5002} \
--workers ${GUNICORN_WORKERS:-2} \
--timeout 120 \
--access-logfile - \
--error-logfile - \
"apps.webhook.app:create_app()"
;;
shell)
echo "[FGTools] Starting interactive shell..."
exec /bin/bash
;;
*)
echo "[FGTools] Unknown service: $1"
echo "Available services: dashboard, weather, webhook, shell"
exit 1
;;
esac