-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
102 lines (96 loc) · 2.52 KB
/
Copy pathdocker-compose.yml
File metadata and controls
102 lines (96 loc) · 2.52 KB
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
version: '3.8'
services:
invoice-ocr:
image: kis2show/get_invoice_done:latest
container_name: invoice-ocr-system
user: "100:100"
ports:
- "8000:8000"
volumes:
- ./invoices:/app/invoices:rw
- ./data:/app/data:rw
- invoice_logs:/app/logs:rw
environment:
- DATABASE_URL=sqlite:///./data/invoices.db
- PYTHONPATH=/app
- INVOICE_DIR=/app/invoices
- LOG_LEVEL=INFO
- SECRET_KEY=${SECRET_KEY:-your-secret-key-here}
- CORS_ORIGINS=${CORS_ORIGINS:-http://localhost:3000,http://localhost:8000}
- MAX_FILE_SIZE=${MAX_FILE_SIZE:-10485760}
- OCR_CONFIDENCE_THRESHOLD=${OCR_CONFIDENCE_THRESHOLD:-0.6}
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
networks:
- invoice-network
depends_on:
- setup-permissions
# 权限设置服务
setup-permissions:
image: alpine:latest
container_name: invoice-permissions-setup
user: "0:0" # root用户用于设置权限
volumes:
- ./invoices:/setup/invoices:rw
- ./data:/setup/data:rw
command: >
sh -c "
echo 'Setting up directory permissions for user 100...' &&
mkdir -p /setup/invoices/pdf /setup/invoices/imge /setup/invoices/unrecognized &&
mkdir -p /setup/data &&
chown -R 100:100 /setup/invoices /setup/data &&
chmod -R 755 /setup/invoices /setup/data &&
echo 'Permissions setup completed successfully!'
"
networks:
- invoice-network
# 可选:添加数据库管理界面
adminer:
image: adminer:latest
container_name: invoice-db-admin
user: "100:100"
ports:
- "8080:8080"
environment:
- ADMINER_DEFAULT_SERVER=invoice-ocr
- ADMINER_DESIGN=pepa-linha
networks:
- invoice-network
profiles:
- admin
depends_on:
- invoice-ocr
# 可选:Nginx反向代理
nginx:
image: nginx:alpine
container_name: invoice-nginx
user: "100:100"
ports:
- "80:8080"
- "443:8443"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
- ./ssl:/etc/nginx/ssl:ro
networks:
- invoice-network
profiles:
- proxy
depends_on:
- invoice-ocr
volumes:
invoice_logs:
driver: local
driver_opts:
type: none
o: bind
device: ./logs
networks:
invoice-network:
driver: bridge
driver_opts:
com.docker.network.bridge.name: invoice-br0