56 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
			
		
		
	
	
			56 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
# LibreTranslate configuration.
 | 
						|
# 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 $REQUESTS --char-limit $CHARACTERS
 | 
						|
    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
 | 
						|
      - $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: $CPU
 | 
						|
          memory: $RAM
 |