Spaces:
OrbitMC
/
Runtime error

OrbitMC commited on
Commit
2f1397e
·
verified ·
1 Parent(s): ff31aaf

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +31 -28
Dockerfile CHANGED
@@ -1,34 +1,37 @@
1
- FROM python:3.11-slim
2
 
3
- # System dependencies
4
- RUN apt-get update && apt-get install -y --no-install-recommends \
5
- ffmpeg git \
 
 
 
6
  && rm -rf /var/lib/apt/lists/*
7
 
8
- # Setup user for Hugging Face (UID 1000)
9
- RUN useradd -m -u 1000 user
10
- USER user
11
- ENV PATH="/home/user/.local/bin:$PATH"
12
- ENV HF_HOME="/home/user/.cache/huggingface"
13
-
14
- WORKDIR /home/user/app
15
-
16
- # Install dependencies
17
- RUN pip install --no-cache-dir --upgrade pip && \
18
- pip install --no-cache-dir --extra-index-url https://download.pytorch.org/whl/cpu \
19
- torch==2.6.0+cpu \
20
- transformers>=4.49.0 \
21
- accelerate>=1.3.0 \
22
- flask==3.1.1 \
23
- gunicorn \
24
- huggingface_hub>=0.27.0 \
25
- edge-tts
26
-
27
- # Copy files and create image directory
28
- COPY --chown=user:user . .
29
- RUN mkdir -p /home/user/app/img
 
30
 
31
  EXPOSE 7860
32
 
33
- # Start with Gunicorn for better stability
34
- CMD ["gunicorn", "-b", "0.0.0.0:7860", "app:app", "--timeout", "120"]
 
1
+ FROM python:3.10-slim
2
 
3
+ # Install build dependencies
4
+ RUN apt-get update && apt-get install -y \
5
+ build-essential \
6
+ cmake \
7
+ git \
8
+ curl \
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
+ # Build llama.cpp from source (CPU only)
12
+ RUN git clone https://github.com/ggerganov/llama.cpp /opt/llama.cpp && \
13
+ cd /opt/llama.cpp && \
14
+ mkdir build && \
15
+ cd build && \
16
+ cmake .. -DGGML_CUDA=OFF -DGGML_METAL=OFF && \
17
+ cmake --build . --config Release -j$(nproc)
18
+
19
+ # The main server binary (new name after recent refactor)
20
+ # It could be: llama-server, llama-cli, or server depending on version
21
+ RUN ls -la /opt/llama.cpp/build/bin/ || ls -la /opt/llama.cpp/build/
22
+
23
+ # Download a small GGUF model (~1-2B params)
24
+ RUN mkdir -p /opt/models && \
25
+ curl -L -o /opt/models/smollm2-1.7b-instruct-q4_k_m.gguf \
26
+ "https://huggingface.co/bartowski/SmolLM2-1.7B-Instruct-GGUF/resolve/main/SmolLM2-1.7B-Instruct-Q4_K_M.gguf"
27
+
28
+ # Install Python dependencies
29
+ WORKDIR /app
30
+ COPY requirements.txt .
31
+ RUN pip install --no-cache-dir -r requirements.txt
32
+
33
+ COPY . .
34
 
35
  EXPOSE 7860
36
 
37
+ CMD ["python", "app.py"]