File tree Expand file tree Collapse file tree 6 files changed +41
-28
lines changed
Expand file tree Collapse file tree 6 files changed +41
-28
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,9 @@ LOG_DEPRECATIONS_CHANNEL=errorlog
1212
1313DB_CONNECTION = sqlite
1414
15+ SESSION_DRIVER = redis
16+ CACHE_STORE = redis
17+
1518FILESYSTEM_DISK = local
1619AWS_ACCESS_KEY_ID =
1720AWS_SECRET_ACCESS_KEY =
Original file line number Diff line number Diff line change 2323 "ext-pcntl" : " *" ,
2424 "ext-pcre" : " *" ,
2525 "ext-pdo" : " *" ,
26+ "ext-redis" : " *" ,
2627 "ext-session" : " *" ,
2728 "ext-tokenizer" : " *" ,
2829 "ext-xml" : " *" ,
Original file line number Diff line number Diff line change 1- ARG PHP_EXTENSIONS="pcntl"
1+ ARG PHP_EXTENSIONS="pcntl redis "
22ARG ADDITIONAL_PACKAGES="bash rclone sqlite"
33
44FROM php:8.4.11-fpm-alpine AS base
@@ -10,14 +10,13 @@ ADD --chmod=777 \
1010 --checksum=sha256:206a8f9b2177703fc5aa924d85ad6c72e82413e2d09635b4c9c82a1b65b5b3d5 \
1111 https://github.com/eficode/wait-for/releases/download/v2.2.4/wait-for /usr/local/bin/wait-for
1212# configure entrypoints and image
13- RUN echo "* * * * * cd /var/www/html && php artisan schedule:run" > /etc/crontabs/www-data
14- COPY --chmod=777 containers/php/entrypoint.sh /usr/local/sbin/entrypoint
15- ENTRYPOINT ["entrypoint" ]
16- CMD ["php-fpm" ]
1713ARG PHP_EXTENSIONS
1814ARG ADDITIONAL_PACKAGES
1915RUN apk add --no-cache ${ADDITIONAL_PACKAGES} \
2016 && install-php-extensions ${PHP_EXTENSIONS}
17+ COPY --chmod=777 containers/php/entrypoint.sh /usr/local/sbin/entrypoint
18+ ENTRYPOINT ["entrypoint" ]
19+ CMD ["php-fpm" ]
2120
2221
2322FROM base AS development
Original file line number Diff line number Diff line change 22
33set -e
44
5- if [ -f ' .env ' ] ; then
6- . .env
7- fi
5+ wait_for_services () {
6+ wait-for " ${PHP_HOST :? Missing PHP_HOST} : ${PHP_PORT :? Missing PHP_PORT} " -t 60
7+ }
88
9- if [ " $1 " = " php-fpm " ] ; then
9+ optimize () {
1010 if [ " $APP_ENV " != " local" ]; then
1111 php artisan optimize
12- else
12+ fi
13+ }
14+
15+ if [ " $1 " = " php-fpm" ]; then
16+ optimize
17+ if [ " $APP_ENV " = " local" ]; then
1318 composer install
1419 fi
1520 php artisan migrate --force
1621 if [ " $( id -u) " = ' 0' ]; then
1722 chown -R www-data:www-data storage
1823 fi
24+ exec " $@ "
1925elif [ " $1 " = " scheduler" ]; then
20- wait-for " ${PHP_HOST:? Missing PHP_HOST} :${PHP_PORT:? Missing PHP_PORT} " -t 60
21- if [ " $APP_ENV " != " local" ]; then
22- php artisan optimize
23- fi
24- set -- crond -f -d 8
26+ wait_for_services
27+ optimize
28+ exec su -s /bin/sh -c " php artisan schedule:work --quiet" www-data
2529elif [ " $1 " = " worker" ]; then
26- wait-for " ${PHP_HOST:? Missing PHP_HOST} :${PHP_PORT:? Missing PHP_PORT} " -t 60
27- if [ " $APP_ENV " != " local" ]; then
28- php artisan optimize
29- fi
30- set -- su -s /bin/sh -c " php artisan queue:work --tries=3 --timeout=1800" www-data
30+ wait_for_services
31+ optimize
32+ exec su -s /bin/sh -c " php artisan queue:work --tries=3 --timeout=1800" www-data
3133elif [ " $1 " = " nightwatch" ]; then
32- wait-for " ${PHP_HOST :? Missing PHP_HOST} : ${PHP_PORT :? Missing PHP_PORT} " -t 60
33- if [ " $APP_ENV " != " local " ] ; then
34- php artisan optimize
35- fi
36- set -- su -s /bin/sh -c " php artisan nightwatch:agent --listen-on 0.0.0.0:2407 " www-data
34+ wait_for_services
35+ optimize
36+ exec su -s /bin/sh -c " php artisan nightwatch:agent --listen-on 0.0.0.0:2407 " www-data
37+ else
38+ exec " $@ "
3739fi
38-
39- exec " $@ "
Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ x-app: &app
1212 volumes :
1313 - /etc/localtime:/etc/localtime:ro
1414 - .:/var/www/html
15+ env_file :
16+ - .env
1517
1618services :
1719 nginx :
@@ -32,6 +34,7 @@ services:
3234 << : *app
3335 user : root
3436 command : scheduler
37+ stop_signal : SIGKILL
3538 environment :
3639 PHP_HOST : php
3740 PHP_PORT : 9000
@@ -46,6 +49,7 @@ services:
4649 << : *app
4750 user : root
4851 command : nightwatch
52+ stop_signal : SIGKILL
4953 environment :
5054 PHP_HOST : php
5155 PHP_PORT : 9000
@@ -55,3 +59,8 @@ services:
5559 timeout : 5s
5660 retries : 3
5761 start_period : 5s
62+ redis :
63+ image : redis:8.2.1-alpine
64+ restart : unless-stopped
65+ ports :
66+ - " 6379:6379"
You can’t perform that action at this time.
0 commit comments