From 929002b0c679d667877de46764bd0caa9fa4efef Mon Sep 17 00:00:00 2001 From: Jean-Michel Date: Wed, 24 Jan 2024 16:04:34 -0500 Subject: [PATCH 1/2] ltmanage in bin This allows using the api key instructions from the readme as-is in the docker container. --- docker-compose.yml | 15 ++++++++++++--- docker/Dockerfile | 2 ++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index f68be5a..707d042 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,15 +9,24 @@ services: restart: unless-stopped ports: - "5000:5000" + ## Uncomment this for logging in docker compose logs + # tty: true healthcheck: - test: ['CMD-SHELL', './venv/bin/python scripts/healthcheck.py'] + test: ['CMD-SHELL', './venv/bin/python scripts/healthcheck.py'] ## Uncomment above command and define your args if necessary # command: --ssl --ga-id MY-GA-ID --req-limit 100 --char-limit 500 - ## Uncomment this section and the `volumes` section if you want to backup your API keys + ## Uncomment this section and the libretranslate_api_keys volume if you want to backup your API keys # environment: + # - LT_API_KEYS=true # - LT_API_KEYS_DB_PATH=/app/db/api_keys.db # Same result as `db/api_keys.db` or `./db/api_keys.db` + ## Uncomment these vars and libretranslate_models volume to optimize loading time. + # - LT_UPDATE_MODELS=true + # - LT_LOAD_ONLY=en,fr # volumes: - # - libretranslate_api_keys:/app/db/api_keys.db + # - libretranslate_api_keys:/app/db + # Keep the models in a docker volume, to avoid re-downloading on startup + # - libretranslate_models:/home/libretranslate/.local:rw # volumes: # libretranslate_api_keys: +# libretranslate_models: diff --git a/docker/Dockerfile b/docker/Dockerfile index f34cd0f..985a43e 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -30,6 +30,8 @@ USER libretranslate COPY --from=builder --chown=1032:1032 /app /app WORKDIR /app +COPY --from=builder --chown=1032:1032 /app/venv/bin/ltmanage /bin/ + RUN if [ "$with_models" = "true" ]; then \ # initialize the language models if [ ! -z "$models" ]; then \ From b3d68153230ae2adfa97750fdc7359313876f52d Mon Sep 17 00:00:00 2001 From: Jean-Michel Date: Wed, 24 Jan 2024 16:36:18 -0500 Subject: [PATCH 2/2] moved ltmanage to /usr/bin --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 985a43e..e883afd 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -30,7 +30,7 @@ USER libretranslate COPY --from=builder --chown=1032:1032 /app /app WORKDIR /app -COPY --from=builder --chown=1032:1032 /app/venv/bin/ltmanage /bin/ +COPY --from=builder --chown=1032:1032 /app/venv/bin/ltmanage /usr/bin/ RUN if [ "$with_models" = "true" ]; then \ # initialize the language models