feat: enhance Dockerfile and README for improved installation and security practices
This commit is contained in:
+3
-1
@@ -30,7 +30,9 @@ WORKDIR /var/www/html
|
||||
COPY . /var/www/html
|
||||
|
||||
# Install PHP dependencies
|
||||
RUN composer install --no-dev --optimize-autoloader
|
||||
RUN git config --global --add safe.directory /var/www/html \
|
||||
&& composer config --global audit.block-insecure false \
|
||||
&& composer install --no-dev --optimize-autoloader --no-security-blocking
|
||||
|
||||
# Configure Apache
|
||||
COPY apache.conf /etc/apache2/sites-available/000-default.conf
|
||||
|
||||
@@ -49,6 +49,14 @@ cp .env.example .env
|
||||
docker compose up -d
|
||||
docker compose exec web composer install
|
||||
|
||||
# Load DB variables from .env for host-side migration commands
|
||||
set -a; source .env; set +a
|
||||
|
||||
# Wait until DB is healthy
|
||||
until [ "$(docker inspect -f '{{.State.Health.Status}}' amnezia-panel-db 2>/dev/null)" = "healthy" ]; do
|
||||
sleep 2
|
||||
done
|
||||
|
||||
# Apply migrations (fresh install + updates)
|
||||
# 1) bootstrap base schema
|
||||
docker compose exec -T db mysql -u"$DB_USERNAME" -p"$DB_PASSWORD" "$DB_DATABASE" < migrations/001_init.sql
|
||||
@@ -63,6 +71,12 @@ done
|
||||
docker-compose up -d
|
||||
docker-compose exec web composer install
|
||||
|
||||
set -a; source .env; set +a
|
||||
|
||||
until [ "$(docker inspect -f '{{.State.Health.Status}}' amnezia-panel-db 2>/dev/null)" = "healthy" ]; do
|
||||
sleep 2
|
||||
done
|
||||
|
||||
docker-compose exec -T db mysql -u"$DB_USERNAME" -p"$DB_PASSWORD" "$DB_DATABASE" < migrations/001_init.sql
|
||||
|
||||
for f in migrations/*.sql; do
|
||||
|
||||
Reference in New Issue
Block a user