-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-entrypoint.sh
More file actions
46 lines (38 loc) · 1.69 KB
/
docker-entrypoint.sh
File metadata and controls
46 lines (38 loc) · 1.69 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
#!/bin/bash
set -e
echo "=== Starting PMD Salesforce Analyzer ==="
echo "PORT: ${PORT:-8080}"
echo "PYTHONUNBUFFERED: ${PYTHONUNBUFFERED}"
echo "DEBUG: ${DEBUG}"
echo "USE_CLOUD_STORAGE: ${USE_CLOUD_STORAGE:-false}"
echo "Working directory: $(pwd)"
# Configure Git to avoid hardlinks (required for Cloud Storage FUSE)
echo "=== Configuring Git ==="
git config --global core.createObject false 2>/dev/null || true
git config --global pack.windowMemory 10m 2>/dev/null || true
git config --global pack.packSizeLimit 20m 2>/dev/null || true
git config --global core.fsyncObjectFiles false 2>/dev/null || true
export GIT_OBJECT_DIRECTORY=/tmp/git-objects
mkdir -p /tmp/git-objects
echo "Git configured to avoid hardlinks"
# Initialize Cloud Storage directories if enabled
if [ "${USE_CLOUD_STORAGE}" = "true" ]; then
echo "=== Initializing Cloud Storage directories ==="
mkdir -p /data/ast /data/database /data/graph/exports /data/graph/graphs
chmod -R 755 /data
echo "Cloud Storage directories initialized"
# Copy sample AST files if /data/ast is empty
if [ ! "$(ls -A /data/ast)" ]; then
echo "Copying sample AST files to Cloud Storage..."
cp -r /app/output/ast/* /data/ast/ 2>/dev/null || echo "No sample files to copy"
fi
else
echo "=== Using local storage ==="
fi
cd /app/backend
echo "=== Running database migrations ==="
python manage.py migrate --noinput || echo "Migration failed but continuing..."
echo "=== Collecting static files ==="
python manage.py collectstatic --noinput --clear || echo "Collectstatic failed but continuing..."
echo "=== Starting Nginx and Gunicorn with Supervisor ==="
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf