# Dockerfile FROM python:3.10-slim # 필요한 패키지, 개발 도구 및 git 설치 (root 권한) RUN apt-get update && \ apt-get install -y tzdata build-essential libsm6 libxext6 libgl1 libglib2.0-0 git curl wget && \ ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime && \ echo "Asia/Seoul" > /etc/timezone && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* RUN useradd -m -u 1000 user USER user ENV PATH="/home/user/.local/bin:$PATH" WORKDIR /app COPY --chown=user ./requirements.txt requirements.txt RUN pip install --no-cache-dir --upgrade -r requirements.txt # ✅ 중요: AdaFace 저장소 클론 및 가중치 미리 다운로드 (서버 시작 속도 최적화) RUN git clone https://github.com/mk-minchul/AdaFace.git /app/AdaFace RUN python -c "from huggingface_hub import hf_hub_download; import shutil; cache_path = hf_hub_download(repo_id='VishalMishraTss/AdaFace', filename='adaface_ir101_webface12m.ckpt'); shutil.copy(cache_path, '/app/adaface_ir101_webface12m.ckpt')" # 최종 앱 코드 복사 COPY --chown=user . /app # 서버 실행 명령 (Hugging Face Spaces 기본 포트 7860) CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]