Spaces:
Sleeping
Sleeping
Dmitry Beresnev
commited on
Commit
·
6e29991
1
Parent(s):
4ec7108
fix dockerfile, pyproject.toml
Browse files- Dockerfile +10 -3
Dockerfile
CHANGED
|
@@ -4,16 +4,17 @@ FROM python:3.12-slim
|
|
| 4 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 5 |
gcc \
|
| 6 |
g++ \
|
|
|
|
| 7 |
&& rm -rf /var/lib/apt/lists/*
|
| 8 |
|
| 9 |
-
RUN pip install --no-cache-dir uv
|
| 10 |
|
| 11 |
WORKDIR /app
|
| 12 |
|
| 13 |
COPY pyproject.toml /app/pyproject.toml
|
| 14 |
|
| 15 |
# Install dependencies (llama-cpp-python will compile but with minimal features)
|
| 16 |
-
ENV CMAKE_ARGS="-DLLAMA_BLAS=OFF -DLLAMA_AVX2=OFF -DLLAMA_FMA=OFF -DLLAMA_F16C=OFF"
|
| 17 |
RUN uv pip install --system -r pyproject.toml
|
| 18 |
|
| 19 |
COPY . /app
|
|
@@ -21,8 +22,14 @@ COPY . /app
|
|
| 21 |
# RUN uv pip install --system --no-cache .
|
| 22 |
|
| 23 |
# Create a non-root user
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
USER user
|
|
|
|
| 26 |
ENV HOME=/home/user \
|
| 27 |
PATH=/home/user/.local/bin:$PATH \
|
| 28 |
HF_HOME=/home/user/.cache/huggingface
|
|
|
|
| 4 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 5 |
gcc \
|
| 6 |
g++ \
|
| 7 |
+
cmake \
|
| 8 |
&& rm -rf /var/lib/apt/lists/*
|
| 9 |
|
| 10 |
+
RUN pip install --no-cache-dir --root-user-action=ignore uv
|
| 11 |
|
| 12 |
WORKDIR /app
|
| 13 |
|
| 14 |
COPY pyproject.toml /app/pyproject.toml
|
| 15 |
|
| 16 |
# Install dependencies (llama-cpp-python will compile but with minimal features)
|
| 17 |
+
#ENV CMAKE_ARGS="-DLLAMA_BLAS=OFF -DLLAMA_AVX2=OFF -DLLAMA_FMA=OFF -DLLAMA_F16C=OFF"
|
| 18 |
RUN uv pip install --system -r pyproject.toml
|
| 19 |
|
| 20 |
COPY . /app
|
|
|
|
| 22 |
# RUN uv pip install --system --no-cache .
|
| 23 |
|
| 24 |
# Create a non-root user
|
| 25 |
+
# explicitly create the HF_HOME directory and give the user ownership
|
| 26 |
+
# so they can save the downloaded model there.
|
| 27 |
+
RUN useradd -m -u 1000 user && \
|
| 28 |
+
mkdir -p /home/user/.cache/huggingface && \
|
| 29 |
+
chown -R user:user /home/user \
|
| 30 |
+
|
| 31 |
USER user
|
| 32 |
+
|
| 33 |
ENV HOME=/home/user \
|
| 34 |
PATH=/home/user/.local/bin:$PATH \
|
| 35 |
HF_HOME=/home/user/.cache/huggingface
|