File size: 1,017 Bytes
4f5bf6b
f17d2c8
46d94c0
4f5bf6b
 
f17d2c8
167cb59
 
 
4f5bf6b
 
34406ea
f17d2c8
34406ea
167cb59
34406ea
46d94c0
f17d2c8
3ff4464
 
 
 
46d94c0
4f5bf6b
167cb59
 
 
4f5bf6b
 
36de5b9
f17d2c8
167cb59
46d94c0
3ff4464
46d94c0
34406ea
3ff4464
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Use a specific version for better stability
FROM python:3.10-alpine

# 1. Install EVERY build dependency needed for a C++ compile on Alpine
# we add linux-headers and python3-dev to prevent "missing header" errors
RUN apk add --no-cache \
    build-base \
    cmake \
    musl-dev \
    python3-dev \
    linux-headers \
    libc6-compat \
    libstdc++ \
    libgomp \
    openblas-dev \
    libgcc

RUN adduser -D -u 1000 user
USER user
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app

# 2. Tell the compiler to use Alpine's math libraries
ENV CMAKE_ARGS="-DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS"

# 3. Install packages
# WARNING: This will take 15 minutes. The logs will look "stuck". 
# DO NOT REBOOT. Let it finish the "Building wheel" stage.
RUN pip install --no-cache-dir --upgrade pip && \
    pip install --no-cache-dir flask flask-cors huggingface-hub && \
    pip install --no-cache-dir llama-cpp-python

COPY --chown=user . $HOME/app

EXPOSE 7860
CMD ["python", "app.py"]