towerops-agent/entrypoint.sh
Graham McIntire 7e2e50a764
Fix Docker permissions with automatic entrypoint script
The Docker container now handles data directory permissions automatically
without requiring manual user setup.

Changes:
- Added entrypoint.sh script that runs as root, fixes /data permissions,
  then drops to non-root user (towerops) using su-exec
- Updated Dockerfile to install su-exec and use the entrypoint script
- Container starts as root but immediately drops privileges after fixing
  permissions

The agent will now start successfully with just 'docker-compose up -d'
without users needing to run chown commands manually.
2026-01-14 09:36:45 -06:00

11 lines
250 B
Bash

#!/bin/sh
set -e
# Ensure /data directory exists and has proper permissions
if [ -d /data ]; then
# Fix ownership if needed
chown -R towerops:towerops /data
fi
# Drop to towerops user and run the agent
exec su-exec towerops towerops-agent "$@"