Soumik Bose commited on
Commit
adff313
·
1 Parent(s): 74b4113

feat: i love ai,but it hates me

Browse files
Files changed (2) hide show
  1. Dockerfile +28 -13
  2. requirements.txt +1 -4
Dockerfile CHANGED
@@ -1,31 +1,46 @@
1
- FROM python:3.10-slim
2
-
3
- ENV PYTHONDONTWRITEBYTECODE=1 \
4
- PYTHONUNBUFFERED=1 \
5
- PORT=7860 \
6
- HF_HOME=/app/cache \
7
- PATH="/home/user/.local/bin:${PATH}"
8
 
 
9
  WORKDIR /app
10
 
11
- # Minimal system dependencies
12
- RUN apt-get update && apt-get install -y \
13
- curl \
 
 
 
14
  && rm -rf /var/lib/apt/lists/*
15
 
16
  # Create non-root user
17
  RUN useradd -m -u 1000 user
18
- RUN mkdir -p /app/cache /app/models && chown -R user:user /app
19
 
20
  USER user
21
 
22
- # Install dependencies
 
 
 
 
 
 
 
23
  RUN pip install --no-cache-dir --upgrade pip
 
 
 
 
 
 
24
  COPY --chown=user:user requirements.txt .
25
  RUN pip install --no-cache-dir -r requirements.txt
26
 
27
- # Copy app
28
  COPY --chown=user:user main.py .
29
 
 
30
  EXPOSE 7860
 
 
31
  CMD ["python", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # Use Python 3.12 slim
2
+ FROM python:3.12-slim
 
 
 
 
 
3
 
4
+ # Set working directory
5
  WORKDIR /app
6
 
7
+ # Install build dependencies
8
+ RUN apt-get update && apt-get install -y --no-install-recommends \
9
+ gcc \
10
+ g++ \
11
+ cmake \
12
+ git \
13
  && rm -rf /var/lib/apt/lists/*
14
 
15
  # Create non-root user
16
  RUN useradd -m -u 1000 user
17
+ RUN chown -R user:user /app
18
 
19
  USER user
20
 
21
+ # Set environment variables
22
+ ENV PATH="/home/user/.local/bin:${PATH}" \
23
+ PYTHONDONTWRITEBYTECODE=1 \
24
+ PYTHONUNBUFFERED=1 \
25
+ PORT=7860 \
26
+ HF_HOME=/app/cache
27
+
28
+ # Upgrade pip
29
  RUN pip install --no-cache-dir --upgrade pip
30
+
31
+ # Install llama-cpp-python (this will build it)
32
+ RUN CMAKE_ARGS="-DGGML_BLAS=OFF -DGGML_NATIVE=OFF" \
33
+ pip install --no-cache-dir llama-cpp-python==0.3.2
34
+
35
+ # Copy and install other requirements
36
  COPY --chown=user:user requirements.txt .
37
  RUN pip install --no-cache-dir -r requirements.txt
38
 
39
+ # Copy application
40
  COPY --chown=user:user main.py .
41
 
42
+ # Expose port
43
  EXPOSE 7860
44
+
45
+ # Run the application
46
  CMD ["python", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
requirements.txt CHANGED
@@ -1,7 +1,4 @@
1
- # Use mrzeeshanahmed's pre-built manylinux wheel
2
- llama-cpp-python @ https://github.com/mrzeeshanahmed/llama-cpp-python/releases/download/v0.3.17-manylinux-x86_64/llama_cpp_python-0.3.17-cp310-cp310-manylinux_2_17_x86_64.whl
3
-
4
  fastapi>=0.115.0
5
  uvicorn>=0.30.0
6
  pydantic>=2.8.0
7
- huggingface-hub>=0.24.0
 
 
 
 
1
  fastapi>=0.115.0
2
  uvicorn>=0.30.0
3
  pydantic>=2.8.0
4
+ huggingface-hub>=0.24.0