File size: 914 Bytes
168ae1c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
version: '3.8'

services:
  streamlit-app:
    build: .
    ports:
      - "8501:8501"
    environment:
      - PYTHONUNBUFFERED=1
      - TRANSFORMERS_CACHE=/app/.cache
    volumes:
      - ./models:/app/saved_model
      - ./data:/app/data
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8501/_stcore/health"]
      interval: 30s
      timeout: 10s
      retries: 3

  api-backend:
    build: .
    ports:
      - "8000:8000"
    command: python api_backend.py
    environment:
      - PYTHONUNBUFFERED=1
    volumes:
      - ./models:/app/saved_model
    restart: unless-stopped

  # Optional: Add PostgreSQL for production
  # db:
  #   image: postgres:13
  #   environment:
  #     POSTGRES_DB: codescanner
  #     POSTGRES_USER: admin
  #     POSTGRES_PASSWORD: secret
  #   volumes:
  #     - postgres_data:/var/lib/postgresql/data

volumes:
  postgres_data: