boffire commited on
Commit
b3c4187
·
verified ·
1 Parent(s): 33261a8

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -105
Dockerfile CHANGED
@@ -1,111 +1,17 @@
1
- FROM libretranslate/libretranslate
2
-
3
- USER root
4
-
5
- RUN apt-get update && apt-get install -y \
6
- curl unzip git python3-pip
7
-
8
- RUN mkdir -p /.local && chmod -R 777 /.local && \
9
- mkdir -p /app/db/sessions && chmod -R 777 /app/db && \
10
- mkdir -p /app/suggestions
11
-
12
- ENV HOME=/app
13
-
14
- # Install Kabyle Tasenselkimt model
15
- RUN curl -L -o /app/en_kab_comp.argosmodel \
16
- https://huggingface.co/spaces/Imsidag-community/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
- # Install en-kab model
20
- RUN curl -L -o /app/en_kab-1_0.argosmodel \
21
- https://huggingface.co/spaces/Imsidag-community/LibreTranslate_Kabyle/resolve/main/en_kab-1_0.argosmodel && \
22
- /app/venv/bin/python3 -c "import argostranslate.package; argostranslate.package.install_from_path('/app/en_kab-1_0.argosmodel')"
23
-
24
- # Install kab-en model
25
- RUN curl -L -o /app/kab_en-1_0.argosmodel \
26
- https://huggingface.co/spaces/Imsidag-community/LibreTranslate_Kabyle/resolve/main/kab_en-1_0.argosmodel && \
27
- /app/venv/bin/python3 -c "import argostranslate.package; argostranslate.package.install_from_path('/app/kab_en-1_0.argosmodel')"
28
-
29
- # Install en-kab model 51000
30
- RUN curl -L -o /app/en_kab-1_2.argosmodel \
31
- https://huggingface.co/spaces/Imsidag-community/LibreTranslate_Kabyle/resolve/main/en_kab-1_2.argosmodel && \
32
- /app/venv/bin/python3 -c "import argostranslate.package; argostranslate.package.install_from_path('/app/en_kab-1_2.argosmodel')"
33
-
34
- # Install en-kab model 27500 with OpenSubtitles BT
35
- RUN curl -L -o /app/en_kab-1_0_os.argosmodel \
36
- https://huggingface.co/spaces/Imsidag-community/LibreTranslate_Kabyle/resolve/main/en_kab-1_0_os.argosmodel && \
37
- /app/venv/bin/python3 -c "import argostranslate.package; argostranslate.package.install_from_path('/app/en_kab-1_0_os.argosmodel')"
38
-
39
- # Install en-zgh tuned OPUS
40
- RUN curl -L -o /app/translate-en_zgh-1_0.argosmodel \
41
- https://huggingface.co/spaces/Imsidag-community/LibreTranslate_Kabyle/resolve/main/translate-en_zgh-1_0.argosmodel && \
42
- /app/venv/bin/python3 -c "import argostranslate.package; argostranslate.package.install_from_path('/app/translate-en_zgh-1_0.argosmodel')"
43
-
44
- # Install en-kab model num 40000
45
- RUN curl -L -o /app/en_kab-num40000.argosmodel \
46
- https://huggingface.co/spaces/Imsidag-community/LibreTranslate_Kabyle/resolve/main/en_kab-num40000.argosmodel && \
47
- /app/venv/bin/python3 -c "import argostranslate.package; argostranslate.package.install_from_path('/app/en_kab-num40000.argosmodel')"
48
-
49
- # Install en-kab model 34000
50
- RUN curl -L -o /app/en_kab-kab.argosmodel \
51
- https://huggingface.co/spaces/Imsidag-community/LibreTranslate_Kabyle/resolve/main/en_kab-kab.argosmodel && \
52
- /app/venv/bin/python3 -c "import argostranslate.package; argostranslate.package.install_from_path('/app/en_kab-kab.argosmodel')"
53
-
54
- # Install Occitan model
55
- RUN curl -L -o /app/translate-en_oc-1_0.argosmodel \
56
- https://huggingface.co/spaces/Imsidag-community/LibreTranslate_Kabyle/resolve/main/translate-en_oc-1_0.argosmodel && \
57
- /app/venv/bin/python3 -c "import argostranslate.package; argostranslate.package.install_from_path('/app/translate-en_oc-1_0.argosmodel')"
58
-
59
- # Install Occitan 20000 model
60
- RUN curl -L -o /app/translate-en_oc-1_1.argosmodel \
61
- https://huggingface.co/spaces/Imsidag-community/LibreTranslate_Kabyle/resolve/main/translate-en_oc-1_1.argosmodel && \
62
- ls -lh /app/translate-en_oc-1_1.argosmodel && \
63
- /app/venv/bin/python3 -c "import argostranslate.package; argostranslate.package.install_from_path('/app/translate-en_oc-1_1.argosmodel')"
64
-
65
- # Install Occitan 26000 model
66
- RUN curl -L -o /app/en_oc-1_3.argosmodel \
67
- https://huggingface.co/spaces/Imsidag-community/LibreTranslate_Kabyle/resolve/main/en_oc-1_3.argosmodel && \
68
- ls -lh /app/en_oc-1_3.argosmodel && \
69
- /app/venv/bin/python3 -c "import argostranslate.package; argostranslate.package.install_from_path('/app/en_oc-1_3.argosmodel')"
70
-
71
- # Install English to Breton OPUS model
72
- RUN curl -L -o /app/opus-en_br-1_0.argosmodel \
73
- https://huggingface.co/spaces/Imsidag-community/LibreTranslate_Kabyle/resolve/main/opus-en_br-1_0.argosmodel && \
74
- ls -lh /app/opus-en_br-1_0.argosmodel && \
75
- /app/venv/bin/python3 -c "import argostranslate.package; argostranslate.package.install_from_path('/app/opus-en_br-1_0.argosmodel')"
76
-
77
- # Install English to French model
78
- RUN curl -L -o /app/en_fr.argosmodel \
79
- https://argos-net.com/v1/translate-en_fr-1_9.argosmodel && \
80
- /app/venv/bin/python3 -c "import argostranslate.package; argostranslate.package.install_from_path('/app/en_fr.argosmodel')"
81
-
82
- # Install French to english model
83
- RUN curl -L -o /app/fr_en.argosmodel \
84
- https://argos-net.com/v1/translate-fr_en-1_9.argosmodel && \
85
- /app/venv/bin/python3 -c "import argostranslate.package; argostranslate.package.install_from_path('/app/fr_en.argosmodel')"
86
-
87
- # Install Catalan to english model
88
- RUN curl -L -o /app/ca_en.argosmodel \
89
- https://argos-net.com/v1/translate-ca_en-1_7.argosmodel && \
90
- /app/venv/bin/python3 -c "import argostranslate.package; argostranslate.package.install_from_path('/app/ca_en.argosmodel')"
91
-
92
- # Install English to Catalan model
93
- RUN curl -L -o /app/en_ca.argosmodel \
94
- https://argos-net.com/v1/translate-en_ca-1_9.argosmodel && \
95
- /app/venv/bin/python3 -c "import argostranslate.package; argostranslate.package.install_from_path('/app/en_ca.argosmodel')"
96
-
97
- # Install German model
98
- RUN curl -L -o /app/en_de.argosmodel \
99
- https://argos-net.com/v1/translate-en_de-1_0.argosmodel && \
100
- /app/venv/bin/python3 -c "import argostranslate.package; argostranslate.package.install_from_path('/app/en_de.argosmodel')"
101
-
102
  # Install Hugging Face hub client
103
  RUN /app/venv/bin/pip install huggingface_hub
104
 
 
 
 
105
  COPY upload_suggestions.py /app/upload_suggestions.py
 
 
 
106
 
107
- ENV LT_HOST="0.0.0.0"
108
- ENV LT_PORT="7860"
 
109
  ENV LT_LOAD_ONLY="en,de,kab,kab_comp,kab_os,kab_num,oc,oc_comp,kab_kab"
110
  ENV LT_SSL=True
111
  ENV LT_SUGGESTIONS="true"
@@ -116,5 +22,4 @@ ENV LT_MAX_TEXT_LENGTH=5000
116
  ENV LT_CHAR_LIMIT=50000
117
  ENV LT_CHAR_LIMIT_WINDOW=3600
118
 
119
- ENTRYPOINT ["bash", "-c"]
120
- CMD ["/app/venv/bin/libretranslate & while true; do /app/venv/bin/python3 /app/upload_suggestions.py; sleep 60; done"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  # Install Hugging Face hub client
2
  RUN /app/venv/bin/pip install huggingface_hub
3
 
4
+ # Install proxy dependencies
5
+ RUN /app/venv/bin/pip install fastapi uvicorn httpx
6
+
7
  COPY upload_suggestions.py /app/upload_suggestions.py
8
+ COPY proxy.py /app/proxy.py
9
+ COPY start.sh /app/start.sh
10
+ RUN chmod +x /app/start.sh
11
 
12
+ # LibreTranslate now runs internally; proxy serves externally
13
+ ENV LT_HOST="127.0.0.1"
14
+ ENV LT_PORT="5000"
15
  ENV LT_LOAD_ONLY="en,de,kab,kab_comp,kab_os,kab_num,oc,oc_comp,kab_kab"
16
  ENV LT_SSL=True
17
  ENV LT_SUGGESTIONS="true"
 
22
  ENV LT_CHAR_LIMIT=50000
23
  ENV LT_CHAR_LIMIT_WINDOW=3600
24
 
25
+ CMD ["/app/start.sh"]