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:
		@@ -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
 | 
			
		||||
```
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
@@ -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
 | 
			
		||||
@@ -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.
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user