[MVC] Исправление Docker: права доступа и .dockerignore

This commit is contained in:
kirill.khorkov
2026-01-03 11:55:13 +03:00
parent d2c15ec37f
commit 6fdf188052
3 changed files with 30 additions and 8 deletions

21
.dockerignore Normal file
View File

@@ -0,0 +1,21 @@
# Git
.git
.gitignore
# IDE
.idea
.vscode
*.swp
*.swo
# OS files
.DS_Store
Thumbs.db
# Logs
*.log
# Temporary files
tmp/
temp/

View File

@@ -1,5 +1,3 @@
version: '3.8'
services:
web:
build:

View File

@@ -2,16 +2,19 @@
set -e
# Включаем mod_rewrite
a2enmod rewrite
a2enmod rewrite 2>/dev/null || true
# Копируем конфигурацию виртуального хоста
cp /etc/apache2/sites-available/vhosts.conf /etc/apache2/sites-enabled/000-default.conf
# Устанавливаем права только на нужные директории, исключая .git
find /var/www/html -maxdepth 1 -type d ! -name '.git' -exec chown -R www-data:www-data {} \; 2>/dev/null || true
find /var/www/html -maxdepth 1 -type f -exec chown www-data:www-data {} \; 2>/dev/null || true
# Устанавливаем права
chown -R www-data:www-data /var/www/html
# Устанавливаем права на ключевые директории
chown -R www-data:www-data /var/www/html/app 2>/dev/null || true
chown -R www-data:www-data /var/www/html/config 2>/dev/null || true
chown -R www-data:www-data /var/www/html/public 2>/dev/null || true
chown -R www-data:www-data /var/www/html/uploads 2>/dev/null || true
echo "Apache configured successfully"
# Запускаем Apache в foreground режиме
exec apache2-foreground