-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
58 lines (46 loc) · 1.54 KB
/
Copy pathDockerfile
File metadata and controls
58 lines (46 loc) · 1.54 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
FROM ubuntu:24.04
ARG DEBIAN_FRONTEND=noninteractive
ARG INSTALL_LOCAL_LLM=false
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
VIRTUAL_ENV=/opt/venv \
PATH="/opt/venv/bin:$PATH"
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
git \
python3 \
python3-venv \
python3-pip \
python3-dev \
build-essential \
cmake \
ninja-build \
pkg-config \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*
RUN python3 -m venv $VIRTUAL_ENV && pip install --upgrade pip setuptools wheel
WORKDIR /app
COPY requirements.txt requirements-prod.txt requirements-llm.txt ./
RUN pip install -r requirements-prod.txt
RUN if [ "$INSTALL_LOCAL_LLM" = "true" ]; then \
apt-get update && apt-get install -y --no-install-recommends \
clang \
libopenblas-dev \
g++-14 \
libstdc++-14-dev \
&& rm -rf /var/lib/apt/lists/* && \
CC=/usr/bin/clang \
CXX=/usr/bin/clang++ \
CMAKE_ARGS="-DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS -DLLAMA_BUILD_TOOLS=OFF -DLLAMA_BUILD_EXAMPLES=OFF -DLLAMA_BUILD_SERVER=OFF" \
FORCE_CMAKE=1 \
pip install --no-cache-dir --force-reinstall --no-binary=llama-cpp-python llama-cpp-python && \
pip install 'huggingface_hub>=0.34.0'; \
fi
COPY . .
RUN useradd -ms /bin/bash appuser && \
mkdir -p /app/media /app/staticfiles /app/models && \
chown -R appuser:appuser /app /opt/venv
USER appuser
EXPOSE 8000
ENTRYPOINT ["/app/docker/entrypoint.sh"]