st192011 commited on
Commit
3366528
·
verified ·
1 Parent(s): 671d95b

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -22
Dockerfile CHANGED
@@ -1,39 +1,30 @@
1
  FROM python:3.10-slim
2
 
3
- # 1. CONFIG: Fix the "Silence" by forcing logs to print immediately
4
- ENV PYTHONUNBUFFERED=1
5
-
6
- # 2. SYSTEM DEPENDENCIES (Run as root)
7
- # We install these first so they are cached
8
  RUN apt-get update && apt-get install -y \
9
  git \
10
  build-essential \
11
  cmake \
 
12
  && rm -rf /var/lib/apt/lists/*
13
 
14
- # 3. SETUP USER 1000 (Required for HF Spaces)
15
- # We create the user now but switch to them later
16
  RUN useradd -m -u 1000 user
17
-
18
- # 4. INSTALL LLAMA-CPP-PYTHON (Your Build Configuration)
19
- # Note: FORCE_CMAKE=1 triggers a compilation from source, which takes time.
20
- ENV CMAKE_ARGS="-DLLAMA_NATIVE=OFF"
21
- ENV FORCE_CMAKE=1
22
-
23
- RUN pip install --no-cache-dir \
24
- llama-cpp-python==0.2.90
25
-
26
- # 5. APP SETUP
27
- # Switch to the user to avoid permission errors on HF Spaces
28
  USER user
29
  ENV HOME=/home/user \
30
  PATH=/home/user/.local/bin:$PATH
 
31
 
32
- WORKDIR /home/user/app
33
-
34
- COPY --chown=user requirements.txt .
35
- RUN pip install --no-cache-dir -r requirements.txt
 
 
 
36
 
 
37
  COPY --chown=user . .
38
 
 
39
  CMD ["python", "app.py"]
 
1
  FROM python:3.10-slim
2
 
3
+ # 1. System dependencies
 
 
 
 
4
  RUN apt-get update && apt-get install -y \
5
  git \
6
  build-essential \
7
  cmake \
8
+ wget \
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
+ # 2. Setup User 1000 (Required for HF Spaces)
 
12
  RUN useradd -m -u 1000 user
 
 
 
 
 
 
 
 
 
 
 
13
  USER user
14
  ENV HOME=/home/user \
15
  PATH=/home/user/.local/bin:$PATH
16
+ WORKDIR $HOME/app
17
 
18
+ # 3. Install requirements
19
+ # We install llama-cpp-python first to utilize caching
20
+ RUN pip install --no-cache-dir \
21
+ llama-cpp-python==0.2.90 \
22
+ huggingface_hub \
23
+ gradio \
24
+ python-dotenv
25
 
26
+ # 4. Copy application files
27
  COPY --chown=user . .
28
 
29
+ # 5. Start the app
30
  CMD ["python", "app.py"]