# ============================================================ # GUARDiA ITSM — Production Dockerfile # Base: Python 3.11-slim # Port: 8001 # ============================================================ FROM python:3.11-slim AS base LABEL maintainer="GUARDiA Team" LABEL description="GUARDiA ITSM — AI 기반 레거시 인프라 자율 운영 플랫폼" # ── 시스템 의존성 ────────────────────────────────────────── RUN apt-get update && apt-get install -y --no-install-recommends \ curl wget git \ libpq-dev gcc \ && rm -rf /var/lib/apt/lists/* # ── 비루트 실행 계정 ─────────────────────────────────────── RUN groupadd -r guardia && useradd -r -g guardia -d /app guardia # ── 작업 디렉토리 ───────────────────────────────────────── WORKDIR /app # ── Python 의존성 (레이어 캐싱 최적화) ───────────────────── COPY itsm/requirements.txt . RUN pip install --no-cache-dir --upgrade pip \ && pip install --no-cache-dir -r requirements.txt # ── 애플리케이션 소스 복사 ─────────────────────────────── COPY itsm/ . # ── 업로드/데이터 디렉토리 ────────────────────────────── RUN mkdir -p uploads/sr_files uploads/workspaces \ && chown -R guardia:guardia /app # ── 환경 기본값 ────────────────────────────────────────── ENV PYTHONUNBUFFERED=1 \ PYTHONIOENCODING=utf-8 \ PYTHONDONTWRITEBYTECODE=1 \ DATABASE_URL="sqlite+aiosqlite:///./guardia_itsm.db" \ OLLAMA_BASE_URL="http://ollama:11434" # ── 포트 노출 ──────────────────────────────────────────── EXPOSE 8001 # ── 비루트 전환 ───────────────────────────────────────── USER guardia # ── 헬스체크 ───────────────────────────────────────────── HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \ CMD curl -sf http://localhost:8001/ || exit 1 # ── 엔트리포인트 ───────────────────────────────────────── CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8001", "--workers", "4"]