Submission: LibreTranslate (#1040)

Co-authored-by: nmfretz <nmfretz@gmail.com>
This commit is contained in:
highghlow 2024-05-28 09:11:48 +03:00 committed by GitHub
parent 098c868b3f
commit 3a3a7a2b3d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 83 additions and 0 deletions

View File

View File

View File

@ -0,0 +1,28 @@
version: "3.7"
services:
app_proxy:
environment:
APP_HOST: libretranslate_main_1
APP_PORT: 5000
PROXY_AUTH_ADD: "false"
main:
image: libretranslate/libretranslate:v1.5.7@sha256:f2ac0b1944da971b3bf1344ec02842800883f2046cdefa868d7dc46a9dff6ed8
restart: on-failure
## Log to docker compose logs. This allows you to see the model download progress when first installing.
tty: true
healthcheck:
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 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:
- ${APP_DATA_DIR}/data/api_keys:/app/db
- ${APP_DATA_DIR}/data/models:/home/libretranslate/.local:rw

26
libretranslate/hooks/pre-start Executable file
View File

@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -euo pipefail
# We're forced to run as user/group 1032: https://github.com/LibreTranslate/LibreTranslate/blob/f7a35db05b3ac7fcd40489faa7da827b03354faf/docker/Dockerfile#L28-L33
# So we set the owner of the data directories to 1032:1032
APP_DATA_DIR="$(readlink -f $(dirname "${BASH_SOURCE[0]}")/..)/data"
DESIRED_OWNER="1032:1032"
API_KEYS_DATA_DIR="${APP_DATA_DIR}/api_keys"
MODELS_DATA_DIR="${APP_DATA_DIR}/models"
set_permissions() {
local -r path="${1}"
if [[ -d "${path}" ]]; then
owner=$(stat -c "%u:%g" "${path}")
if [[ "${owner}" != "${DESIRED_OWNER}" ]]; then
chown "${DESIRED_OWNER}" "${path}"
fi
fi
}
set_permissions "${API_KEYS_DATA_DIR}"
set_permissions "${MODELS_DATA_DIR}"

View File

@ -0,0 +1,29 @@
manifestVersion: 1.1
id: libretranslate
category: ai
name: LibreTranslate
version: "1.5.7"
tagline: Free and Open Source machine translation API
description: >-
⚠️ This app may take up to 10 minutes or more to become accessible after installation, depending on your hardware and internet connection. LibreTranslate must first download around 10 GB of translation models in the background before the UI becomes available. Please be patient.
LibreTranslate is a free and Open Source Machine Translation API, entirely self-hosted.
Unlike other APIs, it doesn't rely on proprietary providers such as Google or Azure to perform translations.
Instead, its translation engine is powered by the open source Argos Translate library.
developer: LibreTranslate Contributors
website: https://libretranslate.com
dependencies: []
repo: https://github.com/LibreTranslate/LibreTranslate
support: https://github.com/LibreTranslate/LibreTranslate/discussions
port: 7017
gallery:
- 1.jpg
- 2.jpg
- 3.jpg
path: ""
defaultUsername: ""
defaultPassword: ""
submitter: highghlow
submission: https://github.com/getumbrel/umbrel/pull/1040