Running Libretraslate on Docker Locally

Hi,

I’m starting with Docker and Linux and I’m trying to create a docker image that contains langage packages, to be run in a local environment that does not have access to internet.

I’ve managed to download the packages, and searched through the github page and this forum, but unfortunately it’s unclear which path should I copy the packages into.

I’ve found this answer, but I’m really not sure how the complete path should be in my Dockerfile (what to put instead of the $HOME variable here):
$HOME/.local/share/argos-translate/packages/

My Dockerfile at the moment is like this:

FROM libretranslate/libretranslate:latest

#Copy Language Models
COPY /translate-ja_en-1_1 /usr/.local/share/argos-translate/packages
COPY /translate-en_ja-1_1 /usr/.local/share/argos-translate/packages

RUN if [ "$with_models" = "true" ]; then  \
  # initialize the language models
  if [ ! -z "$models" ]; then \
  ./venv/bin/python scripts/install_models.py --load_only_lang_codes "$models";   \
  else \
  ./venv/bin/python scripts/install_models.py;  \
  fi \
  fi

EXPOSE 5000
ENTRYPOINT [ "./venv/bin/libretranslate", "--host", "*" ]

Can you please help me configuring this?

Kind Regards,

Lorenzo

Resources: https://community.libretranslate.com/t/start-libretranslate-without-trying-to-download-models/1674

Check LibreTranslate/run.sh at main · LibreTranslate/LibreTranslate · GitHub

Thank you so much, I’ve solved mapping a volume in my host machine to /home/libretranslate/.local as suggested.
Copying the language packs into /share/argos-translate/packages makes it work.

Thanks!