Ensure permissions on volumes are correct

mv public directory inside a single RUN to not increase the image
This commit is contained in:
Benjamin Brummer
2024-12-01 12:11:57 +01:00
parent e7bc565745
commit fab57c9db3
3 changed files with 34 additions and 28 deletions

View File

@@ -29,10 +29,23 @@ docker_process_init_files() {
done
}
# Workaround for application updates
rm -rf /var/www/html/public/*
mv /tmp/public/* /var/www/html/public/
# Create upload directory
mkdir -p /var/www/html/public/uploads
# Ensure owner, file and directory permissions are correct
chown -R www-data:www-data /var/www/html/
find /var/www/html/ -type f -exec chmod 644 {} \;
find /var/www/html/ -type d -exec chmod 755 {} \;
chown -R www-data:www-data \
/var/www/html/storage \
/var/www/html/public
find /var/www/html/storage \
/var/www/html/public \
-type f -exec chmod 644 {} \;
find /var/www/html/storage \
/var/www/html/public \
-type d -exec chmod 755 {} \;
# Clear and cache config in production
if [ "$APP_ENV" = "production" ]; then