Repository navigation
Expand file tree
/
Copy pathdocker-entrypoint.sh
More file actions
43 lines (36 loc) Β· 1.51 KB
/
Copy pathdocker-entrypoint.sh
File metadata and controls
43 lines (36 loc) Β· 1.51 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
#!/bin/bash
# ============================================================
# LDA Docker Entrypoint Script
# ============================================================
# Generates .streamlit/secrets.toml from environment variables
# at container startup, then launches Streamlit.
# ============================================================
set -e
SECRETS_FILE="/app/.streamlit/secrets.toml"
echo "π§ Configuring LDA..."
# Check required environment variables
if [ -z "$SUPABASE_URL" ] || [ -z "$SUPABASE_KEY" ] || [ -z "$GROQ_API_KEY" ]; then
echo "β ERROR: Missing required environment variables."
echo " Required: SUPABASE_URL, SUPABASE_KEY, GROQ_API_KEY"
echo ""
echo " Set them in your .env file or pass them to docker:"
echo " docker run -e SUPABASE_URL=... -e SUPABASE_KEY=... -e GROQ_API_KEY=... lda"
exit 1
fi
echo "π Generating Streamlit secrets from environment variables..."
cat > "$SECRETS_FILE" << EOF
# Auto-generated from environment variables β do not edit manually
SUPABASE_URL = "${SUPABASE_URL}"
SUPABASE_KEY = "${SUPABASE_KEY}"
GROQ_API_KEY = "${GROQ_API_KEY}"
EOF
echo "β
Secrets configured"
echo "π Starting LDA on http://0.0.0.0:${STREAMLIT_SERVER_PORT:-8501}"
# Execute Streamlit
exec streamlit run src/main.py \
--server.port="${STREAMLIT_SERVER_PORT:-8501}" \
--server.address="${STREAMLIT_SERVER_ADDRESS:-0.0.0.0}" \
--server.headless=true \
--browser.gatherUsageStats=false \
--server.enableCORS=false \
--server.enableXsrfProtection=false