mycode / entrypoint.sh
zipusyan's picture
Upload 4 files
bdb2d27 verified
raw
history blame contribute delete
950 Bytes
#!/bin/bash
set -e
PHP_WWW_DIR="/home/www"
OP_DATA_DIR="/home/www/opencode"
OP_CONFIG_DIR="/root/.opencode"
OP_BACKUP_DIR="/app/defaults/opencode"
echo "--- Starting Runtime Initialization ---"
mkdir -p /run/php /var/cache/nginx /var/log/nginx
mkdir -p /tmp/nginx_body /tmp/nginx_proxy /tmp/nginx_fastcgi /tmp/nginx_uwsgi /tmp/nginx_scgi
chown -R root:root /var/cache/nginx /var/log/nginx
if [ ! -f "$PHP_WWW_DIR/ftp.php" ]; then
mkdir -p "$PHP_WWW_DIR"
cp -r /app/defaults/www/* "$PHP_WWW_DIR/"
fi
chown -R www-data:www-data "$PHP_WWW_DIR"
chmod -R 755 "$PHP_WWW_DIR"
mkdir -p "$OP_DATA_DIR"
if [ ! -d "$OP_DATA_DIR/.opencode" ]; then
cp -r "$OP_BACKUP_DIR/.opencode" "$OP_DATA_DIR/"
fi
rm -rf "$OP_CONFIG_DIR"
ln -s "$OP_DATA_DIR/.opencode" "$OP_CONFIG_DIR"
echo "--- Testing Nginx Configuration ---"
nginx -t 2>&1 || true
echo "--- Starting Supervisor ---"
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf