helloguddn (PC helloguddn) commited on
Commit
32dfa8a
·
1 Parent(s): 7cb509d
Files changed (1) hide show
  1. Dockerfile +14 -11
Dockerfile CHANGED
@@ -1,14 +1,17 @@
1
- FROM python:3.10-alpine
2
 
3
- # 1. 빌드 도구 설치 (Alpine용)
4
- # Alpine은 musl libc를 사용하므로, musl 환경용 llama-cpp-python 바이너리가 올바르게 로드됩니다.
5
  USER root
6
- RUN apk add --no-cache \
7
- build-base \
8
  cmake \
9
  git \
10
- libstdc++ \
11
- openmp
 
 
 
 
12
 
13
  ## 2. 사용자 설정 (user는 만들되, 설치는 root로 수행합니다)
14
  RUN useradd -m -u 1000 user
@@ -26,9 +29,8 @@ RUN pip install --no-cache-dir --upgrade pip
26
  COPY requirements.txt .
27
  RUN pip install --no-cache-dir -r requirements.txt
28
 
29
- # 4. llama-cpp-python: 공식 PyPI에서만 설치(glibc 환경바이너리)
30
- # musl libc 에러를 피하기 위해 abetlen 인덱스를 제거합니다.
31
- # --prefer-binary로 가능하면 사전 빌드 휠을 사용합니다.
32
  RUN CMAKE_ARGS="-DLLAMA_BLAS=OFF -DLLAMA_CUBLAS=OFF" \
33
  pip install --no-cache-dir --prefer-binary \
34
  llama-cpp-python
@@ -37,4 +39,5 @@ RUN CMAKE_ARGS="-DLLAMA_BLAS=OFF -DLLAMA_CUBLAS=OFF" \
37
  COPY --chown=user:user . .
38
  USER user
39
 
40
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
1
+ FROM python:3.10-slim
2
 
3
+ # Use Debian-slim (glibc) for compatibility with manylinux wheels on Hugging Face
 
4
  USER root
5
+ RUN apt-get update && apt-get install -y --no-install-recommends \
6
+ build-essential \
7
  cmake \
8
  git \
9
+ gcc \
10
+ g++ \
11
+ libgomp1 \
12
+ libopenblas-dev \
13
+ libstdc++6 \
14
+ && rm -rf /var/lib/apt/lists/*
15
 
16
  ## 2. 사용자 설정 (user는 만들되, 설치는 root로 수행합니다)
17
  RUN useradd -m -u 1000 user
 
29
  COPY requirements.txt .
30
  RUN pip install --no-cache-dir -r requirements.txt
31
 
32
+ # 4. llama-cpp-python: 가능한 경우 manylinux wheel을 사하도록 --prefer-binary
33
+ # If no wheel matches, this will build from source (cmake/python-dev provided above).
 
34
  RUN CMAKE_ARGS="-DLLAMA_BLAS=OFF -DLLAMA_CUBLAS=OFF" \
35
  pip install --no-cache-dir --prefer-binary \
36
  llama-cpp-python
 
39
  COPY --chown=user:user . .
40
  USER user
41
 
42
+ # Use PORT env if provided by hosting (Hugging Face), fallback to 7860
43
+ CMD ["sh", "-c", "uvicorn app:app --host 0.0.0.0 --port ${PORT:-7860}"]