File size: 1,860 Bytes
38818c3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0f60365
 
38818c3
 
 
 
 
0f60365
38818c3
 
0f60365
38818c3
 
 
 
 
0f60365
38818c3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0f60365
38818c3
 
0f60365
38818c3
0f60365
38818c3
 
0f60365
38818c3
 
 
 
0f60365
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
services:
  # Unified service - works for both development and production
  translations:
    platform: "linux/amd64"
    container_name: translations_api

    build:
      context: .

    # Enable GPU access
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: 1
              capabilities: [gpu]

    ports:
      - 7860:7860
      - 5679:5678 # debugpy port for development

    # Mount both code and models (code mount enables live editing in dev)
    volumes:
      - type: bind
        source: ./server/
        target: /home/user/app/server/
      - type: bind
        source: ./server/models/
        target: /home/user/app/models/

    environment:
      - AWS_ACCESS_KEY_ID
      - AWS_SECRET_ACCESS_KEY
      - AWS_SESSION_TOKEN
      - API_LOG_LEVEL=DEBUG # Can be overridden for production
      - CUDA_VISIBLE_DEVICES=0
      - NVIDIA_VISIBLE_DEVICES=all
      - NVIDIA_DRIVER_CAPABILITIES=compute,utility

    # Default to production mode (can be overridden)
    # For development: docker-compose run translations bash ./run_dev.sh
    # For production: docker-compose up translations (uses default CMD)

  # Test service
  test:
    platform: "linux/amd64"
    container_name: translations_test

    build:
      context: .

    volumes:
      - type: bind
        source: ./server/
        target: /home/user/app/server/
      - type: bind
        source: ./server/models/
        target: /home/user/app/models/

    working_dir: /home/user/app

    environment:
      - PYTHONPATH=/home/user/app
      - AWS_ACCESS_KEY_ID
      - AWS_SECRET_ACCESS_KEY
      - AWS_SESSION_TOKEN

    command:
      [
        "conda",
        "run",
        "--no-capture-output",
        "-n",
        "translations-api",
        "bash",
        "/home/user/app/server/run_tests.sh",
      ]