Spaces:
Sleeping
Sleeping
corrected dockerfile aga
Browse files- Dockerfile +10 -1
Dockerfile
CHANGED
|
@@ -5,15 +5,24 @@ COPY backend/requirements.txt backend/requirements-convert.txt ./
|
|
| 5 |
RUN pip install --no-cache-dir -r requirements.txt \
|
| 6 |
&& pip install --no-cache-dir -r requirements-convert.txt --extra-index-url https://download.pytorch.org/whl/cpu
|
| 7 |
|
|
|
|
| 8 |
RUN apt-get update && apt-get install -y --no-install-recommends patchelf \
|
| 9 |
-
&& SO_FILES=$(find / -name
|
| 10 |
&& echo "Found CTranslate2 .so files: $SO_FILES" \
|
| 11 |
&& for f in $SO_FILES; do patchelf --clear-execstack "$f" && echo "Patched: $f"; done \
|
|
|
|
| 12 |
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
|
| 14 |
COPY . .
|
| 15 |
COPY entrypoint.sh .
|
| 16 |
RUN chmod +x entrypoint.sh
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
EXPOSE 7860
|
| 19 |
CMD ["./entrypoint.sh"]
|
|
|
|
| 5 |
RUN pip install --no-cache-dir -r requirements.txt \
|
| 6 |
&& pip install --no-cache-dir -r requirements-convert.txt --extra-index-url https://download.pytorch.org/whl/cpu
|
| 7 |
|
| 8 |
+
# FIX 1: Catch ALL .so files inside the ctranslate2 package (including Python bindings)
|
| 9 |
RUN apt-get update && apt-get install -y --no-install-recommends patchelf \
|
| 10 |
+
&& SO_FILES=$(find /usr/local/lib/python3.11/site-packages -name '*.so*' -path '*ctranslate2*' 2>/dev/null) \
|
| 11 |
&& echo "Found CTranslate2 .so files: $SO_FILES" \
|
| 12 |
&& for f in $SO_FILES; do patchelf --clear-execstack "$f" && echo "Patched: $f"; done \
|
| 13 |
+
&& apt-get purge -y patchelf && apt-get autoremove -y \
|
| 14 |
&& rm -rf /var/lib/apt/lists/*
|
| 15 |
|
| 16 |
COPY . .
|
| 17 |
COPY entrypoint.sh .
|
| 18 |
RUN chmod +x entrypoint.sh
|
| 19 |
|
| 20 |
+
# FIX 2: Create a user with UID 1000 and grant ownership of the working dir
|
| 21 |
+
# so that entrypoint.sh has permission to save the models during runtime conversion.
|
| 22 |
+
RUN useradd -m -u 1000 user \
|
| 23 |
+
&& chown -R user:user /app
|
| 24 |
+
|
| 25 |
+
USER user
|
| 26 |
+
|
| 27 |
EXPOSE 7860
|
| 28 |
CMD ["./entrypoint.sh"]
|