Shrink down to just 1 yml file, putting the CPU and RAM into the env file, since the only docker-compose differences were the resource configuration.

This commit is contained in:
2025-07-23 06:05:21 -07:00
parent 593b1fbaf2
commit 620f3f81b2
4 changed files with 18 additions and 59 deletions

View File

@@ -13,7 +13,7 @@ vi .env
1. Run the `prep.sh` file to create the volume mounts.
```
$DOCKER_HOME/Config/LibreTranslate/prep.sh
./prep.sh
```
2. If using a temporary location for `models/` such as `/tmp/`, ensure
@@ -26,5 +26,6 @@ that `prep.sh` is in `root`'s crontab.
3. Start the container up as normal.
```
cp docker-compose.main.yml docker-compose.yml
docker compose up -d
```

View File

@@ -1,4 +1,4 @@
# LibreTranslate configuration for a capable server.
# LibreTranslate configuration.
# Example docker-compose.yml:
# https://github.com/LibreTranslate/LibreTranslate/blob/main/docker-compose.yml
@@ -51,5 +51,5 @@ services:
mode: global
resources:
limits:
cpus: '2.00'
memory: 4G
cpus: $CPU
memory: $RAM

View File

@@ -1,55 +0,0 @@
# LibreTranslate configuration for a small-scale server (1 CPU, 1GB RAM).
# 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: '0.25'
memory: 640M

View File

@@ -2,6 +2,19 @@
COMPOSE_BAKE=true
### Container Specs ###
## For a small-scale server (such as 1 CPU, 1GB RAM).
CPU_MINIMAL=0.25
RAM_MINIMAL=640M
## For a fully capable server.
CPU_RECOMMENDED=2.00
RAM_RECOMMENDED=4.0G
CPU=$CPU_RECOMMENDED
RAM=$RAM_RECOMMENDED
### Languages ###
## Check for language model updates on each run.