Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +9 -7
Dockerfile
CHANGED
|
@@ -1,27 +1,29 @@
|
|
| 1 |
-
# Use Alpine
|
| 2 |
FROM python:3.10-alpine
|
| 3 |
|
| 4 |
-
# Install
|
| 5 |
RUN apk add --no-cache \
|
| 6 |
-
build-base \
|
| 7 |
libgomp \
|
| 8 |
libstdc++ \
|
| 9 |
-
|
| 10 |
-
python3-dev \
|
| 11 |
-
libffi-dev
|
| 12 |
|
|
|
|
| 13 |
RUN adduser -D -u 1000 user
|
| 14 |
USER user
|
| 15 |
ENV HOME=/home/user \
|
| 16 |
PATH=/home/user/.local/bin:$PATH
|
| 17 |
WORKDIR $HOME/app
|
| 18 |
|
| 19 |
-
#
|
|
|
|
| 20 |
RUN pip install --no-cache-dir \
|
| 21 |
huggingface-hub \
|
| 22 |
flask \
|
|
|
|
| 23 |
llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
|
| 24 |
|
|
|
|
| 25 |
COPY --chown=user . $HOME/app
|
| 26 |
|
|
|
|
| 27 |
CMD ["python", "app.py"]
|
|
|
|
| 1 |
+
# 1. Use Alpine - This is the "Musl" environment the wheels want
|
| 2 |
FROM python:3.10-alpine
|
| 3 |
|
| 4 |
+
# 2. Install only the runtime math libraries (No heavy compilers needed)
|
| 5 |
RUN apk add --no-cache \
|
|
|
|
| 6 |
libgomp \
|
| 7 |
libstdc++ \
|
| 8 |
+
libgcc
|
|
|
|
|
|
|
| 9 |
|
| 10 |
+
# 3. Setup the user for Hugging Face
|
| 11 |
RUN adduser -D -u 1000 user
|
| 12 |
USER user
|
| 13 |
ENV HOME=/home/user \
|
| 14 |
PATH=/home/user/.local/bin:$PATH
|
| 15 |
WORKDIR $HOME/app
|
| 16 |
|
| 17 |
+
# 4. Force-install the pre-built Alpine wheel
|
| 18 |
+
# This index hosts the 'musl' wheels that match this OS perfectly
|
| 19 |
RUN pip install --no-cache-dir \
|
| 20 |
huggingface-hub \
|
| 21 |
flask \
|
| 22 |
+
--prefer-binary \
|
| 23 |
llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
|
| 24 |
|
| 25 |
+
# 5. Bring in your Maira code
|
| 26 |
COPY --chown=user . $HOME/app
|
| 27 |
|
| 28 |
+
# 6. Run the engine
|
| 29 |
CMD ["python", "app.py"]
|