RFP_summary_chatbot / Dockerfile
Dongjin1203's picture
Test GGUF with lightweight build
856f2a5
# ===== HuggingFace Space Docker =====
FROM python:3.12-slim
# ν™˜κ²½λ³€μˆ˜
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
# μ‹œμŠ€ν…œ νŒ¨ν‚€μ§€ μ„€μΉ˜
RUN apt-get update && apt-get install -y \
git \
curl \
build-essential \
cmake \
wget \
libgomp1 \
&& rm -rf /var/lib/apt/lists/*
# μž‘μ—… 디렉토리
WORKDIR /app
# ===== ν™˜κ²½λ³€μˆ˜ μ„€μ • =====
ENV HOME=/app
ENV STREAMLIT_SERVER_FILE_WATCHER_TYPE=none
ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
ENV HF_HOME=/app/.cache/huggingface
ENV HF_HUB_CACHE=/app/.cache/huggingface/hub
ENV HUGGINGFACE_HUB_CACHE=/app/.cache/huggingface/hub
ENV OMP_NUM_THREADS=1
ENV MKL_NUM_THREADS=1
ENV NUMEXPR_NUM_THREADS=1
ENV CHROMA_DB_PATH=/app/.cache/chroma_db
# μΊμ‹œ 디렉토리 생성
RUN mkdir -p /app/.cache/huggingface /app/.streamlit && \
chmod -R 777 /app/.cache /app/.streamlit
# μ˜μ‘΄μ„± 파일 볡사
COPY requirements.txt .
# pip μ—…κ·Έλ ˆμ΄λ“œ
RUN pip install --no-cache-dir --upgrade pip setuptools wheel
# PyTorch μ„€μΉ˜ (CUDA 지원)
RUN pip install --no-cache-dir \
torch==2.3.0 \
torchvision==0.18.0 \
torchaudio==2.3.0 \
--index-url https://download.pytorch.org/whl/cu121
# llama-cpp-python μ„€μΉ˜ (사전 λΉŒλ“œ CUDA 버전)
RUN pip install --no-cache-dir \
llama-cpp-python==0.2.90 \
--extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cu121
# λ‚˜λ¨Έμ§€ νŒ¨ν‚€μ§€ μ„€μΉ˜
RUN pip install --no-cache-dir -r requirements.txt
# ν”„λ‘œμ νŠΈ 파일 볡사 (start.sh 포함)
COPY . .
# start.sh μ‹€ν–‰ κΆŒν•œ λΆ€μ—¬ (ν™•μ‹€ν•˜κ²Œ)
RUN chmod +x /app/start.sh || echo "start.sh not found, will create"
# start.shκ°€ μ—†μœΌλ©΄ 직접 생성 (Fallback)
RUN if [ ! -f /app/start.sh ]; then \
echo '#!/bin/bash' > /app/start.sh && \
echo 'streamlit run chatbot_app.py --server.port=7860 --server.address=0.0.0.0 --server.headless=true' >> /app/start.sh && \
chmod +x /app/start.sh; \
fi
# κΆŒν•œ 확인 (디버깅)
RUN ls -la /app/start.sh
# Streamlit 포트
EXPOSE 7860
# μ‹œμž‘ (μ•ˆμ „ν•˜κ²Œ)
CMD ["/bin/bash", "/app/start.sh"]