Add an initial working configuration for LibreTranslate.

This commit is contained in:
2025-07-23 05:55:40 -07:00
parent e661b67b57
commit 593b1fbaf2
6 changed files with 201 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
# LibreTranslate configuration for a capable server.
# Example docker-compose.yml:
# https://github.com/LibreTranslate/LibreTranslate/blob/main/docker-compose.yml
# Named volumes ensure that the container user gets the correct permissions.
volumes:
libretranslate_api_keys:
driver: local
driver_opts:
type: none
device: $API_KEYS_DIR
o: bind
libretranslate_models:
driver: local
driver_opts:
type: none
device: $MODELS_DIR
o: bind
services:
## Main ##
lt-app:
container_name: lt-app
build:
context: ./
network: host
restart: always
ports:
- "5000:5000"
# Uncomment this for logging in docker compose logs
tty: true
healthcheck:
test: ['CMD-SHELL', './venv/bin/python scripts/healthcheck.py']
command: --req-limit 100 --char-limit 2000
environment:
# Allow the saving of API Keys. Requires volume libretranslate_api_keys.
- LT_API_KEYS=true
- LT_API_KEYS_DB_PATH=/app/db/api_keys.db
# Optimize loading time. Requires volume libretranslate_models.
- LT_UPDATE_MODELS=$UPDATE_MODELS
- LT_LOAD_ONLY=$LANGUAGES
volumes:
# Store the API keys.
- libretranslate_api_keys:/app/db
# Avoid re-downloading language models every reboot.
- libretranslate_models:/home/libretranslate/.local:rw
deploy:
mode: global
resources:
limits:
cpus: '2.00'
memory: 4G