Skip to content

Commit

Permalink
Automatically fix file and folder permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
fabioassuncao committed Aug 23, 2024
1 parent d308c55 commit c5652a7
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions php/8.2-nginx/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,17 @@ log() {

# Function to run setup tasks
run_setup_tasks() {
log "INFO" "Preparing application..."
if [ -w /var/www/html/storage ]; then
chown -R www-data:www-data /var/www/html/storage
else
log "WARNING" "Insufficient permissions to change ownership of storage directory"
fi
log "INFO" "Changing permissions..."
chown -R :www-data /var/www/html/storage/app
chown -R :www-data /var/www/html/storage/logs
chown -R :www-data /var/www/html/bootstrap/cache
find /var/www/html/storage/ -type f -exec chmod 664 {} \;
find /var/www/html/storage/ -type d -exec chmod 775 {} \;
find /var/www/html/bootstrap/cache/ -type f -exec chmod 664 {} \;
find /var/www/html/bootstrap/cache/ -type d -exec chmod 775 {} \;


log "INFO" "Preparing application..."
$ARTISAN storage:link || log "WARNING" "Failed to create storage link"
$ARTISAN config:cache || log "WARNING" "Failed to cache config"
$ARTISAN migrate --force || log "WARNING" "Failed to run migrations"
Expand Down

0 comments on commit c5652a7

Please sign in to comment.