-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
Β·63 lines (56 loc) Β· 3.62 KB
/
Copy pathentrypoint.sh
File metadata and controls
executable file
Β·63 lines (56 loc) Β· 3.62 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
#!/usr/bin/env bash
# =============================================================================
# Voice-to-Notes β Container Entrypoint
# =============================================================================
# This script:
# 1. Validates that /app/data is properly mounted (warns if not)
# 2. Ensures required subdirectories exist
# 3. Executes the original command (uvicorn or python run_watcher.py)
# =============================================================================
set -e
# ANSI color codes
RED='\033[0;31m'
YELLOW='\033[1;33m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
# ============================================================================
# STEP 1: Check if /app/data is mounted
# ============================================================================
# If /app/data is on a different device/filesystem than /app, it's mounted.
# This prevents data loss from being stored only in the container layer.
APP_DEV=$(stat -c '%d' /app 2>/dev/null || stat -f '%d' /app 2>/dev/null)
DATA_DEV=$(stat -c '%d' /app/data 2>/dev/null || stat -f '%d' /app/data 2>/dev/null)
if [ "$APP_DEV" = "$DATA_DEV" ]; then
echo ""
echo -e "${RED}ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ${NC}"
echo -e "${RED}β β οΈ WARNING β οΈ β${NC}"
echo -e "${RED}β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ£${NC}"
echo -e "${RED}β /app/data is NOT mounted as a volume! β${NC}"
echo -e "${RED}β β${NC}"
echo -e "${RED}β Your data will be LOST when the container is removed. β${NC}"
echo -e "${RED}β β${NC}"
echo -e "${RED}β To fix this, ensure docker-compose.yml has: β${NC}"
echo -e "${RED}β volumes: β${NC}"
echo -e "${RED}β - \${DATA_DIR:-~/voice-notes-data}:/app/data β${NC}"
echo -e "${RED}β β${NC}"
echo -e "${RED}β Starting anyway (for development/testing purposes)... β${NC}"
echo -e "${RED}ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ${NC}"
echo ""
sleep 3
else
echo -e "${GREEN}β${NC} /app/data is properly mounted as a volume"
fi
# ============================================================================
# STEP 2: Ensure subdirectories exist
# ============================================================================
echo "Ensuring data subdirectories exist..."
mkdir -p /app/data/engine/processing
mkdir -p /app/data/engine/failed
mkdir -p /app/data/uploads
echo -e "${GREEN}β${NC} Data directory structure ready"
# ============================================================================
# STEP 3: Execute the original command
# ============================================================================
echo "Starting application: $@"
echo ""
exec "$@"