File size: 1,580 Bytes
6db5454
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Etiya doc-to-lora UI — local container deployment
#
# Usage:
#   1. cp .env.example .env.local        (or set HF_TOKEN in your shell)
#   2. docker compose up --build         (builds image, starts container)
#   3. open http://localhost:3000
#
# To rebuild after code changes:
#   docker compose up --build --force-recreate
#
# To inspect inside the container:
#   docker compose exec d2l-ui sh

services:
  d2l-ui:
    build:
      context: .
      dockerfile: Dockerfile
    image: etiya/d2l-ui:latest
    container_name: d2l-ui
    restart: unless-stopped
    ports:
      # Local dev exposes 3000; container internally listens on PORT env (default 7860 in image).
      # Override PORT inside container to 3000 to match the local convention.
      - "3000:3000"
    environment:
      PORT: 3000
      # HF_TOKEN read from .env.local (host) at container startup —
      # never baked into the image. Rotate by editing .env.local + restarting.
      HF_TOKEN: ${HF_TOKEN:?HF_TOKEN must be set in .env.local or shell}
      D2L_API_URL: ${D2L_API_URL:-https://etiya-d2l-api.hf.space}
      NODE_ENV: production
    env_file:
      - .env.local
    healthcheck:
      test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:3000"]
      interval: 30s
      timeout: 5s
      retries: 3
      start_period: 15s
    # Resource limits — tune to host. Frontend is light (~150MB image, ~80MB RAM).
    deploy:
      resources:
        limits:
          cpus: "1.0"
          memory: 512M
        reservations:
          cpus: "0.25"
          memory: 128M