Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +15 -15
Dockerfile
CHANGED
|
@@ -1,31 +1,31 @@
|
|
| 1 |
-
# 1. Use
|
| 2 |
-
FROM python:3.10-
|
| 3 |
|
| 4 |
-
# 2. Install
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
|
|
|
| 9 |
python3-dev \
|
| 10 |
-
|
|
|
|
| 11 |
|
| 12 |
-
# 3. Setup User
|
| 13 |
-
RUN
|
| 14 |
USER user
|
| 15 |
ENV HOME=/home/user \
|
| 16 |
PATH=/home/user/.local/bin:$PATH
|
| 17 |
WORKDIR $HOME/app
|
| 18 |
|
| 19 |
-
# 4.
|
| 20 |
-
# These are universal wheels that work on Debian/Ubuntu (Hugging Face's native language)
|
| 21 |
RUN pip install --no-cache-dir \
|
| 22 |
huggingface-hub \
|
| 23 |
flask \
|
| 24 |
-
--prefer-binary \
|
| 25 |
llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
|
| 26 |
|
| 27 |
-
# 5. Copy your
|
| 28 |
COPY --chown=user . $HOME/app
|
| 29 |
|
| 30 |
-
# 6.
|
| 31 |
CMD ["python", "app.py"]
|
|
|
|
| 1 |
+
# 1. Use Alpine - This natively has the 'musl' library the AI is crying for
|
| 2 |
+
FROM python:3.10-alpine
|
| 3 |
|
| 4 |
+
# 2. Install every possible dependency the brain needs to think
|
| 5 |
+
RUN apk add --no-cache \
|
| 6 |
+
build-base \
|
| 7 |
+
libgomp \
|
| 8 |
+
libstdc++ \
|
| 9 |
+
cmake \
|
| 10 |
python3-dev \
|
| 11 |
+
libffi-dev \
|
| 12 |
+
git
|
| 13 |
|
| 14 |
+
# 3. Setup User
|
| 15 |
+
RUN adduser -D -u 1000 user
|
| 16 |
USER user
|
| 17 |
ENV HOME=/home/user \
|
| 18 |
PATH=/home/user/.local/bin:$PATH
|
| 19 |
WORKDIR $HOME/app
|
| 20 |
|
| 21 |
+
# 4. Install the library - Using the index that matches Alpine perfectly
|
|
|
|
| 22 |
RUN pip install --no-cache-dir \
|
| 23 |
huggingface-hub \
|
| 24 |
flask \
|
|
|
|
| 25 |
llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
|
| 26 |
|
| 27 |
+
# 5. Copy your files
|
| 28 |
COPY --chown=user . $HOME/app
|
| 29 |
|
| 30 |
+
# 6. Start
|
| 31 |
CMD ["python", "app.py"]
|