2024-08-05 12:06:20 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
main() {
|
2025-05-22 13:21:56 +02:00
|
|
|
local COMMAND_AS_STRING="$*"
|
|
|
|
|
local ROLE="api" # Default role
|
|
|
|
|
|
|
|
|
|
case "$COMMAND_AS_STRING" in
|
|
|
|
|
*"artisan queue:work"*)
|
|
|
|
|
ROLE="worker"
|
|
|
|
|
;;
|
|
|
|
|
*"artisan schedule:work"*)
|
|
|
|
|
ROLE="scheduler"
|
|
|
|
|
;;
|
|
|
|
|
*)
|
|
|
|
|
# Defaults to "api" for any other command (e.g., php-fpm)
|
|
|
|
|
ROLE="api"
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
echo "Determined role: $ROLE for command: $COMMAND_AS_STRING"
|
|
|
|
|
|
|
|
|
|
apply_php_configuration
|
|
|
|
|
prep_file_permissions
|
|
|
|
|
prep_storage
|
|
|
|
|
wait_for_db
|
|
|
|
|
|
|
|
|
|
if [ "$ROLE" = "api" ]; then
|
|
|
|
|
echo "Running setup for API role..."
|
2024-08-28 17:20:17 +02:00
|
|
|
apply_db_migrations
|
2025-02-14 23:32:55 +01:00
|
|
|
run_init_project
|
|
|
|
|
optimize_application
|
2025-05-22 13:21:56 +02:00
|
|
|
echo "Starting server for API role with command: $@"
|
|
|
|
|
exec "$@"
|
|
|
|
|
elif [ "$ROLE" = "scheduler" ]; then
|
|
|
|
|
echo "Running setup for Scheduler role..."
|
|
|
|
|
echo "Initializing scheduler status for first run (entrypoint)"
|
|
|
|
|
php ./artisan app:scheduler-status --mode=record
|
|
|
|
|
echo "Starting scheduler with command: $@"
|
|
|
|
|
exec "$@"
|
|
|
|
|
elif [ "$ROLE" = "worker" ]; then
|
|
|
|
|
echo "Running setup for Worker role..."
|
|
|
|
|
echo "Starting worker with command: $@"
|
|
|
|
|
exec "$@"
|
|
|
|
|
else
|
|
|
|
|
# This case should ideally not be reached if ROLE defaults to "api"
|
|
|
|
|
echo "Error: Unknown role '$ROLE' determined from command '$COMMAND_AS_STRING'. Exiting."
|
|
|
|
|
exit 1
|
2024-08-28 17:20:17 +02:00
|
|
|
fi
|
2024-08-05 12:06:20 +02:00
|
|
|
}
|
|
|
|
|
|
Enhance Docker Configuration and Health Checks (#761)
* Enhance Docker Configuration and Health Checks
- Added PHP configuration settings in `docker-compose.dev.yml` and `docker-compose.yml` to improve memory management and execution limits, ensuring better performance for PHP applications.
- Introduced health checks for various services including `api`, `api-worker`, `api-scheduler`, `ui`, `redis`, and `db` to ensure service availability and reliability.
- Updated environment variables in `.env.docker` and `client/.env.docker` to include new keys for H-Captcha and reCAPTCHA, enhancing security features.
- Refactored the PHP-FPM entrypoint script to apply PHP configurations dynamically based on environment variables, improving flexibility in deployment.
- Removed outdated PHP configuration files to streamline the Docker setup.
These changes aim to enhance the overall stability, performance, and security of the application in a Dockerized environment.
* Refactor Dockerfile for Improved Build Process
- Changed the Dockerfile to utilize a multi-stage build approach, separating the build and runtime environments for better efficiency.
- Introduced a builder stage using the PHP CLI image to install dependencies and extensions, optimizing the final image size.
- Removed unnecessary installation steps and combined related commands to streamline the Dockerfile, enhancing readability and maintainability.
- Updated the runtime stage to use the PHP FPM Alpine image, ensuring a smaller and more secure production environment.
These changes aim to improve the build process, reduce image size, and enhance the overall performance of the Dockerized application.
2025-05-20 19:20:44 +02:00
|
|
|
apply_php_configuration() {
|
|
|
|
|
echo "Applying PHP configuration from environment variables"
|
|
|
|
|
|
|
|
|
|
# Create custom PHP config file
|
|
|
|
|
PHP_CUSTOM_CONFIG_FILE="/usr/local/etc/php/conf.d/99-custom.ini"
|
|
|
|
|
|
2025-05-22 19:48:11 +02:00
|
|
|
# Apply memory limit if provided, otherwise default to 1G
|
Enhance Docker Configuration and Health Checks (#761)
* Enhance Docker Configuration and Health Checks
- Added PHP configuration settings in `docker-compose.dev.yml` and `docker-compose.yml` to improve memory management and execution limits, ensuring better performance for PHP applications.
- Introduced health checks for various services including `api`, `api-worker`, `api-scheduler`, `ui`, `redis`, and `db` to ensure service availability and reliability.
- Updated environment variables in `.env.docker` and `client/.env.docker` to include new keys for H-Captcha and reCAPTCHA, enhancing security features.
- Refactored the PHP-FPM entrypoint script to apply PHP configurations dynamically based on environment variables, improving flexibility in deployment.
- Removed outdated PHP configuration files to streamline the Docker setup.
These changes aim to enhance the overall stability, performance, and security of the application in a Dockerized environment.
* Refactor Dockerfile for Improved Build Process
- Changed the Dockerfile to utilize a multi-stage build approach, separating the build and runtime environments for better efficiency.
- Introduced a builder stage using the PHP CLI image to install dependencies and extensions, optimizing the final image size.
- Removed unnecessary installation steps and combined related commands to streamline the Dockerfile, enhancing readability and maintainability.
- Updated the runtime stage to use the PHP FPM Alpine image, ensuring a smaller and more secure production environment.
These changes aim to improve the build process, reduce image size, and enhance the overall performance of the Dockerized application.
2025-05-20 19:20:44 +02:00
|
|
|
if [ -n "$PHP_MEMORY_LIMIT" ]; then
|
|
|
|
|
echo "memory_limit = $PHP_MEMORY_LIMIT" >> $PHP_CUSTOM_CONFIG_FILE
|
2025-05-22 19:48:11 +02:00
|
|
|
else
|
|
|
|
|
echo "memory_limit = 1G" >> $PHP_CUSTOM_CONFIG_FILE
|
Enhance Docker Configuration and Health Checks (#761)
* Enhance Docker Configuration and Health Checks
- Added PHP configuration settings in `docker-compose.dev.yml` and `docker-compose.yml` to improve memory management and execution limits, ensuring better performance for PHP applications.
- Introduced health checks for various services including `api`, `api-worker`, `api-scheduler`, `ui`, `redis`, and `db` to ensure service availability and reliability.
- Updated environment variables in `.env.docker` and `client/.env.docker` to include new keys for H-Captcha and reCAPTCHA, enhancing security features.
- Refactored the PHP-FPM entrypoint script to apply PHP configurations dynamically based on environment variables, improving flexibility in deployment.
- Removed outdated PHP configuration files to streamline the Docker setup.
These changes aim to enhance the overall stability, performance, and security of the application in a Dockerized environment.
* Refactor Dockerfile for Improved Build Process
- Changed the Dockerfile to utilize a multi-stage build approach, separating the build and runtime environments for better efficiency.
- Introduced a builder stage using the PHP CLI image to install dependencies and extensions, optimizing the final image size.
- Removed unnecessary installation steps and combined related commands to streamline the Dockerfile, enhancing readability and maintainability.
- Updated the runtime stage to use the PHP FPM Alpine image, ensuring a smaller and more secure production environment.
These changes aim to improve the build process, reduce image size, and enhance the overall performance of the Dockerized application.
2025-05-20 19:20:44 +02:00
|
|
|
fi
|
|
|
|
|
|
2025-05-22 19:48:11 +02:00
|
|
|
# Apply max execution time if provided, otherwise default to 300s
|
Enhance Docker Configuration and Health Checks (#761)
* Enhance Docker Configuration and Health Checks
- Added PHP configuration settings in `docker-compose.dev.yml` and `docker-compose.yml` to improve memory management and execution limits, ensuring better performance for PHP applications.
- Introduced health checks for various services including `api`, `api-worker`, `api-scheduler`, `ui`, `redis`, and `db` to ensure service availability and reliability.
- Updated environment variables in `.env.docker` and `client/.env.docker` to include new keys for H-Captcha and reCAPTCHA, enhancing security features.
- Refactored the PHP-FPM entrypoint script to apply PHP configurations dynamically based on environment variables, improving flexibility in deployment.
- Removed outdated PHP configuration files to streamline the Docker setup.
These changes aim to enhance the overall stability, performance, and security of the application in a Dockerized environment.
* Refactor Dockerfile for Improved Build Process
- Changed the Dockerfile to utilize a multi-stage build approach, separating the build and runtime environments for better efficiency.
- Introduced a builder stage using the PHP CLI image to install dependencies and extensions, optimizing the final image size.
- Removed unnecessary installation steps and combined related commands to streamline the Dockerfile, enhancing readability and maintainability.
- Updated the runtime stage to use the PHP FPM Alpine image, ensuring a smaller and more secure production environment.
These changes aim to improve the build process, reduce image size, and enhance the overall performance of the Dockerized application.
2025-05-20 19:20:44 +02:00
|
|
|
if [ -n "$PHP_MAX_EXECUTION_TIME" ]; then
|
|
|
|
|
echo "max_execution_time = $PHP_MAX_EXECUTION_TIME" >> $PHP_CUSTOM_CONFIG_FILE
|
2025-05-22 19:48:11 +02:00
|
|
|
else
|
|
|
|
|
echo "max_execution_time = 300" >> $PHP_CUSTOM_CONFIG_FILE
|
Enhance Docker Configuration and Health Checks (#761)
* Enhance Docker Configuration and Health Checks
- Added PHP configuration settings in `docker-compose.dev.yml` and `docker-compose.yml` to improve memory management and execution limits, ensuring better performance for PHP applications.
- Introduced health checks for various services including `api`, `api-worker`, `api-scheduler`, `ui`, `redis`, and `db` to ensure service availability and reliability.
- Updated environment variables in `.env.docker` and `client/.env.docker` to include new keys for H-Captcha and reCAPTCHA, enhancing security features.
- Refactored the PHP-FPM entrypoint script to apply PHP configurations dynamically based on environment variables, improving flexibility in deployment.
- Removed outdated PHP configuration files to streamline the Docker setup.
These changes aim to enhance the overall stability, performance, and security of the application in a Dockerized environment.
* Refactor Dockerfile for Improved Build Process
- Changed the Dockerfile to utilize a multi-stage build approach, separating the build and runtime environments for better efficiency.
- Introduced a builder stage using the PHP CLI image to install dependencies and extensions, optimizing the final image size.
- Removed unnecessary installation steps and combined related commands to streamline the Dockerfile, enhancing readability and maintainability.
- Updated the runtime stage to use the PHP FPM Alpine image, ensuring a smaller and more secure production environment.
These changes aim to improve the build process, reduce image size, and enhance the overall performance of the Dockerized application.
2025-05-20 19:20:44 +02:00
|
|
|
fi
|
|
|
|
|
|
2025-05-22 19:48:11 +02:00
|
|
|
# Apply upload max filesize if provided, otherwise default to 50M
|
Enhance Docker Configuration and Health Checks (#761)
* Enhance Docker Configuration and Health Checks
- Added PHP configuration settings in `docker-compose.dev.yml` and `docker-compose.yml` to improve memory management and execution limits, ensuring better performance for PHP applications.
- Introduced health checks for various services including `api`, `api-worker`, `api-scheduler`, `ui`, `redis`, and `db` to ensure service availability and reliability.
- Updated environment variables in `.env.docker` and `client/.env.docker` to include new keys for H-Captcha and reCAPTCHA, enhancing security features.
- Refactored the PHP-FPM entrypoint script to apply PHP configurations dynamically based on environment variables, improving flexibility in deployment.
- Removed outdated PHP configuration files to streamline the Docker setup.
These changes aim to enhance the overall stability, performance, and security of the application in a Dockerized environment.
* Refactor Dockerfile for Improved Build Process
- Changed the Dockerfile to utilize a multi-stage build approach, separating the build and runtime environments for better efficiency.
- Introduced a builder stage using the PHP CLI image to install dependencies and extensions, optimizing the final image size.
- Removed unnecessary installation steps and combined related commands to streamline the Dockerfile, enhancing readability and maintainability.
- Updated the runtime stage to use the PHP FPM Alpine image, ensuring a smaller and more secure production environment.
These changes aim to improve the build process, reduce image size, and enhance the overall performance of the Dockerized application.
2025-05-20 19:20:44 +02:00
|
|
|
if [ -n "$PHP_UPLOAD_MAX_FILESIZE" ]; then
|
|
|
|
|
echo "upload_max_filesize = $PHP_UPLOAD_MAX_FILESIZE" >> $PHP_CUSTOM_CONFIG_FILE
|
2025-05-22 19:48:11 +02:00
|
|
|
else
|
|
|
|
|
echo "upload_max_filesize = 50M" >> $PHP_CUSTOM_CONFIG_FILE
|
Enhance Docker Configuration and Health Checks (#761)
* Enhance Docker Configuration and Health Checks
- Added PHP configuration settings in `docker-compose.dev.yml` and `docker-compose.yml` to improve memory management and execution limits, ensuring better performance for PHP applications.
- Introduced health checks for various services including `api`, `api-worker`, `api-scheduler`, `ui`, `redis`, and `db` to ensure service availability and reliability.
- Updated environment variables in `.env.docker` and `client/.env.docker` to include new keys for H-Captcha and reCAPTCHA, enhancing security features.
- Refactored the PHP-FPM entrypoint script to apply PHP configurations dynamically based on environment variables, improving flexibility in deployment.
- Removed outdated PHP configuration files to streamline the Docker setup.
These changes aim to enhance the overall stability, performance, and security of the application in a Dockerized environment.
* Refactor Dockerfile for Improved Build Process
- Changed the Dockerfile to utilize a multi-stage build approach, separating the build and runtime environments for better efficiency.
- Introduced a builder stage using the PHP CLI image to install dependencies and extensions, optimizing the final image size.
- Removed unnecessary installation steps and combined related commands to streamline the Dockerfile, enhancing readability and maintainability.
- Updated the runtime stage to use the PHP FPM Alpine image, ensuring a smaller and more secure production environment.
These changes aim to improve the build process, reduce image size, and enhance the overall performance of the Dockerized application.
2025-05-20 19:20:44 +02:00
|
|
|
fi
|
|
|
|
|
|
2025-05-22 19:48:11 +02:00
|
|
|
# Apply post max size if provided, otherwise default to 55M
|
Enhance Docker Configuration and Health Checks (#761)
* Enhance Docker Configuration and Health Checks
- Added PHP configuration settings in `docker-compose.dev.yml` and `docker-compose.yml` to improve memory management and execution limits, ensuring better performance for PHP applications.
- Introduced health checks for various services including `api`, `api-worker`, `api-scheduler`, `ui`, `redis`, and `db` to ensure service availability and reliability.
- Updated environment variables in `.env.docker` and `client/.env.docker` to include new keys for H-Captcha and reCAPTCHA, enhancing security features.
- Refactored the PHP-FPM entrypoint script to apply PHP configurations dynamically based on environment variables, improving flexibility in deployment.
- Removed outdated PHP configuration files to streamline the Docker setup.
These changes aim to enhance the overall stability, performance, and security of the application in a Dockerized environment.
* Refactor Dockerfile for Improved Build Process
- Changed the Dockerfile to utilize a multi-stage build approach, separating the build and runtime environments for better efficiency.
- Introduced a builder stage using the PHP CLI image to install dependencies and extensions, optimizing the final image size.
- Removed unnecessary installation steps and combined related commands to streamline the Dockerfile, enhancing readability and maintainability.
- Updated the runtime stage to use the PHP FPM Alpine image, ensuring a smaller and more secure production environment.
These changes aim to improve the build process, reduce image size, and enhance the overall performance of the Dockerized application.
2025-05-20 19:20:44 +02:00
|
|
|
if [ -n "$PHP_POST_MAX_SIZE" ]; then
|
|
|
|
|
echo "post_max_size = $PHP_POST_MAX_SIZE" >> $PHP_CUSTOM_CONFIG_FILE
|
2025-05-22 19:48:11 +02:00
|
|
|
else
|
|
|
|
|
echo "post_max_size = 55M" >> $PHP_CUSTOM_CONFIG_FILE
|
Enhance Docker Configuration and Health Checks (#761)
* Enhance Docker Configuration and Health Checks
- Added PHP configuration settings in `docker-compose.dev.yml` and `docker-compose.yml` to improve memory management and execution limits, ensuring better performance for PHP applications.
- Introduced health checks for various services including `api`, `api-worker`, `api-scheduler`, `ui`, `redis`, and `db` to ensure service availability and reliability.
- Updated environment variables in `.env.docker` and `client/.env.docker` to include new keys for H-Captcha and reCAPTCHA, enhancing security features.
- Refactored the PHP-FPM entrypoint script to apply PHP configurations dynamically based on environment variables, improving flexibility in deployment.
- Removed outdated PHP configuration files to streamline the Docker setup.
These changes aim to enhance the overall stability, performance, and security of the application in a Dockerized environment.
* Refactor Dockerfile for Improved Build Process
- Changed the Dockerfile to utilize a multi-stage build approach, separating the build and runtime environments for better efficiency.
- Introduced a builder stage using the PHP CLI image to install dependencies and extensions, optimizing the final image size.
- Removed unnecessary installation steps and combined related commands to streamline the Dockerfile, enhancing readability and maintainability.
- Updated the runtime stage to use the PHP FPM Alpine image, ensuring a smaller and more secure production environment.
These changes aim to improve the build process, reduce image size, and enhance the overall performance of the Dockerized application.
2025-05-20 19:20:44 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Log applied configuration
|
|
|
|
|
echo "Applied PHP configuration:"
|
|
|
|
|
cat $PHP_CUSTOM_CONFIG_FILE
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-05 12:06:20 +02:00
|
|
|
prep_file_permissions() {
|
|
|
|
|
chmod a+x ./artisan
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-28 17:20:17 +02:00
|
|
|
prep_storage() {
|
Enhance Docker Configuration and Health Checks (#761)
* Enhance Docker Configuration and Health Checks
- Added PHP configuration settings in `docker-compose.dev.yml` and `docker-compose.yml` to improve memory management and execution limits, ensuring better performance for PHP applications.
- Introduced health checks for various services including `api`, `api-worker`, `api-scheduler`, `ui`, `redis`, and `db` to ensure service availability and reliability.
- Updated environment variables in `.env.docker` and `client/.env.docker` to include new keys for H-Captcha and reCAPTCHA, enhancing security features.
- Refactored the PHP-FPM entrypoint script to apply PHP configurations dynamically based on environment variables, improving flexibility in deployment.
- Removed outdated PHP configuration files to streamline the Docker setup.
These changes aim to enhance the overall stability, performance, and security of the application in a Dockerized environment.
* Refactor Dockerfile for Improved Build Process
- Changed the Dockerfile to utilize a multi-stage build approach, separating the build and runtime environments for better efficiency.
- Introduced a builder stage using the PHP CLI image to install dependencies and extensions, optimizing the final image size.
- Removed unnecessary installation steps and combined related commands to streamline the Dockerfile, enhancing readability and maintainability.
- Updated the runtime stage to use the PHP FPM Alpine image, ensuring a smaller and more secure production environment.
These changes aim to improve the build process, reduce image size, and enhance the overall performance of the Dockerized application.
2025-05-20 19:20:44 +02:00
|
|
|
local app_storage_path="/usr/share/nginx/html/storage"
|
2024-08-05 12:06:20 +02:00
|
|
|
|
Enhance Docker Configuration and Health Checks (#761)
* Enhance Docker Configuration and Health Checks
- Added PHP configuration settings in `docker-compose.dev.yml` and `docker-compose.yml` to improve memory management and execution limits, ensuring better performance for PHP applications.
- Introduced health checks for various services including `api`, `api-worker`, `api-scheduler`, `ui`, `redis`, and `db` to ensure service availability and reliability.
- Updated environment variables in `.env.docker` and `client/.env.docker` to include new keys for H-Captcha and reCAPTCHA, enhancing security features.
- Refactored the PHP-FPM entrypoint script to apply PHP configurations dynamically based on environment variables, improving flexibility in deployment.
- Removed outdated PHP configuration files to streamline the Docker setup.
These changes aim to enhance the overall stability, performance, and security of the application in a Dockerized environment.
* Refactor Dockerfile for Improved Build Process
- Changed the Dockerfile to utilize a multi-stage build approach, separating the build and runtime environments for better efficiency.
- Introduced a builder stage using the PHP CLI image to install dependencies and extensions, optimizing the final image size.
- Removed unnecessary installation steps and combined related commands to streamline the Dockerfile, enhancing readability and maintainability.
- Updated the runtime stage to use the PHP FPM Alpine image, ensuring a smaller and more secure production environment.
These changes aim to improve the build process, reduce image size, and enhance the overall performance of the Dockerized application.
2025-05-20 19:20:44 +02:00
|
|
|
# Create Laravel-specific directories directly in the mounted volume
|
|
|
|
|
mkdir -p "$app_storage_path/app/public"
|
|
|
|
|
mkdir -p "$app_storage_path/framework/cache/data"
|
|
|
|
|
mkdir -p "$app_storage_path/framework/sessions"
|
|
|
|
|
mkdir -p "$app_storage_path/framework/views"
|
|
|
|
|
mkdir -p "$app_storage_path/logs"
|
2024-08-28 17:20:17 +02:00
|
|
|
|
Enhance Docker Configuration and Health Checks (#761)
* Enhance Docker Configuration and Health Checks
- Added PHP configuration settings in `docker-compose.dev.yml` and `docker-compose.yml` to improve memory management and execution limits, ensuring better performance for PHP applications.
- Introduced health checks for various services including `api`, `api-worker`, `api-scheduler`, `ui`, `redis`, and `db` to ensure service availability and reliability.
- Updated environment variables in `.env.docker` and `client/.env.docker` to include new keys for H-Captcha and reCAPTCHA, enhancing security features.
- Refactored the PHP-FPM entrypoint script to apply PHP configurations dynamically based on environment variables, improving flexibility in deployment.
- Removed outdated PHP configuration files to streamline the Docker setup.
These changes aim to enhance the overall stability, performance, and security of the application in a Dockerized environment.
* Refactor Dockerfile for Improved Build Process
- Changed the Dockerfile to utilize a multi-stage build approach, separating the build and runtime environments for better efficiency.
- Introduced a builder stage using the PHP CLI image to install dependencies and extensions, optimizing the final image size.
- Removed unnecessary installation steps and combined related commands to streamline the Dockerfile, enhancing readability and maintainability.
- Updated the runtime stage to use the PHP FPM Alpine image, ensuring a smaller and more secure production environment.
These changes aim to improve the build process, reduce image size, and enhance the overall performance of the Dockerized application.
2025-05-20 19:20:44 +02:00
|
|
|
# Set permissions for the entire storage directory
|
|
|
|
|
chown -R www-data:www-data "$app_storage_path"
|
|
|
|
|
chmod -R 775 "$app_storage_path"
|
2024-08-28 17:20:17 +02:00
|
|
|
|
|
|
|
|
touch /var/log/opnform.log
|
|
|
|
|
chown www-data /var/log/opnform.log
|
|
|
|
|
|
Enhance Docker Configuration and Health Checks (#761)
* Enhance Docker Configuration and Health Checks
- Added PHP configuration settings in `docker-compose.dev.yml` and `docker-compose.yml` to improve memory management and execution limits, ensuring better performance for PHP applications.
- Introduced health checks for various services including `api`, `api-worker`, `api-scheduler`, `ui`, `redis`, and `db` to ensure service availability and reliability.
- Updated environment variables in `.env.docker` and `client/.env.docker` to include new keys for H-Captcha and reCAPTCHA, enhancing security features.
- Refactored the PHP-FPM entrypoint script to apply PHP configurations dynamically based on environment variables, improving flexibility in deployment.
- Removed outdated PHP configuration files to streamline the Docker setup.
These changes aim to enhance the overall stability, performance, and security of the application in a Dockerized environment.
* Refactor Dockerfile for Improved Build Process
- Changed the Dockerfile to utilize a multi-stage build approach, separating the build and runtime environments for better efficiency.
- Introduced a builder stage using the PHP CLI image to install dependencies and extensions, optimizing the final image size.
- Removed unnecessary installation steps and combined related commands to streamline the Dockerfile, enhancing readability and maintainability.
- Updated the runtime stage to use the PHP FPM Alpine image, ensuring a smaller and more secure production environment.
These changes aim to improve the build process, reduce image size, and enhance the overall performance of the Dockerized application.
2025-05-20 19:20:44 +02:00
|
|
|
# Run Laravel's storage link command (ensure script is run from app root or adjust path to artisan)
|
|
|
|
|
echo "Creating public storage symlink"
|
2025-05-22 13:21:56 +02:00
|
|
|
php ./artisan storage:link
|
2024-08-05 12:06:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
wait_for_db() {
|
2024-08-08 16:33:01 +02:00
|
|
|
echo "Waiting for DB to be ready"
|
2025-05-22 13:21:56 +02:00
|
|
|
until php ./artisan migrate:status 2>&1 | grep -q -E "(Migration table not found|Migration name)"; do
|
2024-08-05 12:06:20 +02:00
|
|
|
sleep 1
|
|
|
|
|
done
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-28 17:20:17 +02:00
|
|
|
apply_db_migrations() {
|
|
|
|
|
echo "Running DB Migrations"
|
2025-05-22 13:21:56 +02:00
|
|
|
php ./artisan migrate --force
|
2024-08-05 12:06:20 +02:00
|
|
|
}
|
|
|
|
|
|
2024-08-28 17:20:17 +02:00
|
|
|
run_init_project() {
|
|
|
|
|
echo "Running app:init-project command"
|
2025-05-22 13:21:56 +02:00
|
|
|
php ./artisan app:init-project
|
2024-08-28 17:20:17 +02:00
|
|
|
}
|
2024-08-05 12:06:20 +02:00
|
|
|
|
2025-02-14 23:32:55 +01:00
|
|
|
optimize_application() {
|
2025-05-23 20:40:56 +02:00
|
|
|
echo "Clearing application cache"
|
|
|
|
|
php ./artisan optimize:clear
|
|
|
|
|
|
2025-02-14 23:32:55 +01:00
|
|
|
echo "Optimizing application"
|
2025-05-22 13:21:56 +02:00
|
|
|
php ./artisan optimize
|
2024-08-05 12:06:20 +02:00
|
|
|
}
|
|
|
|
|
|
2024-08-08 16:33:01 +02:00
|
|
|
main "$@"
|