campus-rag-backend / Dockerfile
Gyuri0315
feat: 백엔드 초기 배포 - FastAPI + sentence-transformers
a9ca6be
Raw History Blame Contribute Delete
765 Bytes
FROM python:3.11-slim
# 시스템 의존성
RUN apt-get update && apt-get install -y build-essential && rm -rf /var/lib/apt/lists/*
# HF Spaces는 user로 실행해야 함
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
WORKDIR /app
# requirements 먼저 설치 (캐시 활용)
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && pip install --no-cache-dir -r requirements.txt
# 앱 코드 복사
COPY --chown=user app/ ./app/
COPY --chown=user prompts/ ./prompts/
# HF Spaces 기본 포트는 7860
EXPOSE 7860
# 모델 캐시 디렉토리 (user의 home 안에)
ENV HF_HOME=/home/user/.cache/huggingface
# uvicorn 시작
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]