Spaces:
Running
Running
cool commited on
Update Dockerfile
Browse files- Dockerfile +12 -28
Dockerfile
CHANGED
|
@@ -4,39 +4,23 @@ USER root
|
|
| 4 |
|
| 5 |
RUN apt-get update && apt-get install -y curl unzip
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
RUN mkdir -p /.local \
|
| 9 |
-
|
| 10 |
-
&& mkdir -p /app/.local/cache/argos-translate \
|
| 11 |
-
&& mkdir -p /app/db/sessions \
|
| 12 |
-
&& chmod -R 777 /.local /app/db /app/.local
|
| 13 |
|
| 14 |
-
#
|
| 15 |
-
RUN mkdir -p /app/models
|
| 16 |
-
|
| 17 |
-
# Set HOME under /app so everything, including cache, is within writable scope
|
| 18 |
ENV HOME=/app
|
| 19 |
|
| 20 |
-
#
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
ENV LT_SUGGESTIONS="true"
|
| 25 |
|
| 26 |
-
#
|
| 27 |
ENV LT_HOST="0.0.0.0"
|
| 28 |
ENV LT_PORT="7860"
|
| 29 |
ENV LT_LOAD_ONLY="en,fr,kab_comp"
|
| 30 |
-
ENV LT_SSL=
|
| 31 |
-
|
| 32 |
-
# Remove any stale packages before installing
|
| 33 |
-
RUN rm -rf /app/.local/share/argos-translate/packages/*
|
| 34 |
-
|
| 35 |
-
# Download and install your Kabyle model
|
| 36 |
-
RUN curl -L -o /app/models/en_kab_comp.argosmodel \
|
| 37 |
-
https://huggingface.co/spaces/axxam/LibreTranslate_Kabyle/resolve/main/en_kab_comp.argosmodel
|
| 38 |
-
|
| 39 |
-
COPY install_model.py /app/install_model.py
|
| 40 |
-
RUN /app/venv/bin/python3 /app/install_model.py
|
| 41 |
|
| 42 |
-
ENTRYPOINT ["/app/venv/bin/libretranslate"
|
|
|
|
| 4 |
|
| 5 |
RUN apt-get update && apt-get install -y curl unzip
|
| 6 |
|
| 7 |
+
# Make .local and session DB directories writable
|
| 8 |
+
RUN mkdir -p /.local && chmod -R 777 /.local && \
|
| 9 |
+
mkdir -p /app/db/sessions && chmod -R 777 /app/db
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
+
# Set HOME to a writable directory
|
|
|
|
|
|
|
|
|
|
| 12 |
ENV HOME=/app
|
| 13 |
|
| 14 |
+
# Download and install the Kabyle model
|
| 15 |
+
RUN curl -L -o /app/en_kab_comp.argosmodel \
|
| 16 |
+
https://huggingface.co/spaces/axxam/LibreTranslate_Kabyle/resolve/main/en_kab_comp.argosmodel && \
|
| 17 |
+
/app/venv/bin/python3 -c "import argostranslate.package; argostranslate.package.install_from_path('/app/en_kab_comp.argosmodel')"
|
|
|
|
| 18 |
|
| 19 |
+
# Set environment variables
|
| 20 |
ENV LT_HOST="0.0.0.0"
|
| 21 |
ENV LT_PORT="7860"
|
| 22 |
ENV LT_LOAD_ONLY="en,fr,kab_comp"
|
| 23 |
+
ENV LT_SSL=True
|
| 24 |
+
ENV LT_SUGGESTIONS="true"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
+
ENTRYPOINT ["/app/venv/bin/libretranslate"]
|