File tree Expand file tree Collapse file tree 9 files changed +76
-16
lines changed Expand file tree Collapse file tree 9 files changed +76
-16
lines changed Original file line number Diff line number Diff line change 1+ # User and Group settings
2+ GROUP_ID = 1000
3+ GROUP_NAME = www-data
4+ USER_ID = 1000
5+ USER_NAME = www-data
6+
7+ # Yii2 environment settings
8+ YII_DEBUG = true
9+ YII_ENV = dev
Original file line number Diff line number Diff line change @@ -3,10 +3,10 @@ bootstrap: _bootstrap.php
33support_namespace : Support
44paths :
55 tests : tests
6- output : runtime/output
6+ output : public/ runtime/output
77 data : tests/Support/data
88 support : tests/Support
9- envs : runtime/_envs
9+ envs : public/ runtime/_envs
1010actor_suffix : Tester
1111settings :
1212 memory_limit : 1024M
Original file line number Diff line number Diff line change 11services :
22 yii2-frankenphp :
33 build :
4+ args :
5+ USER_ID : ${USER_ID:-1000}
6+ GROUP_ID : ${GROUP_ID:-1000}
7+ USER_NAME : ${USER_NAME:-www-data}
8+ GROUP_NAME : ${GROUP_NAME:-www-data}
9+ context : .
410 dockerfile : docker/frankenphp/Dockerfile
511 container_name : yii2-frankenphp
12+ env_file :
13+ - .env
614 restart : always
715 working_dir : /app
816 volumes :
@@ -16,6 +24,8 @@ services:
1624 - ' 8444:443/udp'
1725 environment :
1826 TZ : " UTC"
27+ YII_DEBUG : " ${YII_DEBUG:-false}"
28+ YII_ENV : " ${YII_ENV:-prod}"
1929 tty : true
2030
2131# Volumes needed for Caddy certificates and configuration
Original file line number Diff line number Diff line change 11FROM dunglas/frankenphp:1.8-php8.4
22
3+ # Build arguments for user/group
4+ ARG USER_ID=1000
5+ ARG GROUP_ID=1000
6+ ARG USER_NAME=www-data
7+ ARG GROUP_NAME=www-data
8+
39# Change web server config
410COPY docker/frankenphp/Caddyfile /etc/caddy/Caddyfile
511
@@ -47,7 +53,18 @@ COPY docker/frankenphp/supervisord/conf.d/frankenphp.conf /etc/supervisor/conf.d
4753# Copy queue worker config uncommented for use with yii2-queue
4854# COPY docker/frankenphp/supervisord/conf.d/queue.conf /etc/supervisor/conf.d/queue.conf
4955
50- RUN mkdir -p /var/run && chown -R www-data:www-data /var/run
56+ # Create necessary directories and set permissions
57+ RUN mkdir -p /app/runtime/cache /app/runtime/logs && \
58+ chown -R ${USER_NAME}:${GROUP_NAME} /var/run /app && \
59+ chown -R ${USER_NAME}:${GROUP_NAME} /app/public /app/runtime && \
60+ chmod -R 755 /app && \
61+ chmod -R 775 /app/runtime /app/public
62+
63+ # Copy init script
64+ COPY docker/init.sh /usr/local/bin/init.sh
65+
66+ # Make init script executable
67+ RUN chmod +x /usr/local/bin/init.sh
5168
52- # Run supervisord
53- CMD ["supervisord" , "-c" , "/etc/supervisor/supervisord.conf " ]
69+ # Run initialization script and then supervisord
70+ CMD ["/usr/local/bin/init.sh " ]
Original file line number Diff line number Diff line change 1+ # Check if composer.json exists and vendor directory doesn't exist
2+ if [ -f " /app/composer.json" ] && [ ! -d " /app/vendor" ]; then
3+ echo " Installing Composer dependencies..."
4+
5+ # Install dependencies based on environment
6+ if [ " $YII_ENV " = " prod" ]; then
7+ # Production: exclude dev dependencies and optimize autoloader
8+ composer install --no-dev --optimize-autoloader --no-interaction
9+ else
10+ # Development: include dev dependencies
11+ composer install --optimize-autoloader --no-interaction
12+ fi
13+
14+ # Set proper ownership for vendor directory
15+ chown -R $USER_NAME :$GROUP_NAME /app/vendor
16+
17+ echo " Composer dependencies installed successfully."
18+ fi
19+
20+ # Start supervisord
21+ exec supervisord -c /etc/supervisor/supervisord.conf
Original file line number Diff line number Diff line change 1- ; apc.enable_cli = 1
1+ # Global PHP configuration for the Docker container
22date.timezone = UTC
3+ display_errors = Off
4+ expose_php = Off
5+ memory_limit = 512M
6+ post_max_size = 150M
37session.auto_start = Off
48short_open_tag = Off
5- expose_php = Off
69upload_max_filesize = 15M
7- post_max_size = 150M
8- memory_limit = 512M
9- display_errors = Off
1010
1111# https://symfony.com/doc/current/performance.html
12+ # OPcache optimizations
13+ opcache.enable = 1
14+ opcache.enable_cli = 1
1215opcache.interned_strings_buffer = 16
16+ opcache.jit = tracing
17+ opcache.jit_buffer_size = 64M
1318opcache.max_accelerated_files = 20000
1419opcache.memory_consumption = 256
15- opcache.validate_timestamps = 0
20+ opcache.revalidate_freq = 2
21+ opcache.validate_timestamps = 1
1622realpath_cache_size = 4096K
17- realpath_cache_ttl = 600
18- opcache.preload_user = www-data
23+ realpath_cache_ttl = 120
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ parameters:
1414 - tests/Functional
1515 - tests/Unit
1616
17- tmpDir : %currentWorkingDirectory%/runtime
17+ tmpDir : %currentWorkingDirectory%/public/ runtime
1818
1919 yii2 :
2020 config_path : %currentWorkingDirectory%/config/web/app.php
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments