- Mount /mnt/smb-ame as /smb-share in container - Entrypoint creates watch/output/logs subdirectories if missing - Creates bind-mounts from /smb-share/watch to /watch, etc. - Graceful fallback if SMB share not mounted on host - Works without pre-existing subdirectories on SMB server Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
45 lines
1.4 KiB
Bash
Executable file
45 lines
1.4 KiB
Bash
Executable file
#!/bin/bash
|
|
set -e
|
|
|
|
echo "=== AME Remote Job Manager — Entrypoint ==="
|
|
|
|
# Mount points from docker-compose.yml bind-mounts
|
|
SMB_SHARE="/smb-share"
|
|
WATCH_DIR="/watch"
|
|
OUTPUT_DIR="/output"
|
|
LOGS_DIR="/ame-logs"
|
|
|
|
# Check if SMB share is mounted
|
|
if [ ! -d "$SMB_SHARE" ]; then
|
|
echo "⚠ SMB share not mounted at $SMB_SHARE"
|
|
echo " Ensure the host has mounted: sudo mount -t cifs //172.18.210.5/ame /mnt/smb-ame"
|
|
mkdir -p "$WATCH_DIR" "$OUTPUT_DIR" "$LOGS_DIR"
|
|
echo "Created fallback local directories"
|
|
else
|
|
echo "✓ SMB share mounted at $SMB_SHARE"
|
|
|
|
# Create subdirectories if they don't exist
|
|
mkdir -p "$SMB_SHARE/watch" "$SMB_SHARE/output" "$SMB_SHARE/logs"
|
|
|
|
# Bind-mount SMB subdirectories to container paths
|
|
mkdir -p "$WATCH_DIR" "$OUTPUT_DIR" "$LOGS_DIR"
|
|
|
|
mount --bind "$SMB_SHARE/watch" "$WATCH_DIR" 2>/dev/null || echo "⚠ Could not bind watch folder"
|
|
mount --bind "$SMB_SHARE/output" "$OUTPUT_DIR" 2>/dev/null || echo "⚠ Could not bind output folder"
|
|
mount --bind "$SMB_SHARE/logs" "$LOGS_DIR" 2>/dev/null || echo "⚠ Could not bind logs folder"
|
|
|
|
echo "✓ Mount points configured"
|
|
fi
|
|
|
|
# Verify paths exist
|
|
echo "Verifying mount points..."
|
|
for dir in "$WATCH_DIR" "$OUTPUT_DIR" "$LOGS_DIR"; do
|
|
if [ -d "$dir" ]; then
|
|
echo "✓ $dir is accessible"
|
|
else
|
|
echo "⚠ $dir not accessible"
|
|
fi
|
|
done
|
|
|
|
echo "Starting Node.js application..."
|
|
exec node server.js
|