Skip to content

Commit 8945ce4

Browse files
author
Allyson Silva
committed
feat: Added running with Laravel Octane
1 parent fe6e67a commit 8945ce4

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

php/Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ RUN set -xe; \
143143
amqp-1.11.0 \
144144
xdebug-3.1.5 \
145145
pcov-1.0.11 \
146+
; \
147+
pecl install -o -f -D 'enable-sockets="yes" enable-openssl="yes" enable-http2="yes" enable-mysqlnd="yes" enable-swoole-json="yes" enable-swoole-curl="yes" enable-cares="no"' swoole-4.8.12 \
146148
; \
147149
\
148150
# Igbinary: Is a drop in replacement for the standard php serializer.
@@ -163,6 +165,7 @@ RUN set -xe; \
163165
amqp \
164166
xdebug \
165167
pcov \
168+
swoole \
166169
igbinary \
167170
msgpack \
168171
redis \
@@ -340,6 +343,11 @@ VOLUME ${LOG_PATH}
340343

341344
ENTRYPOINT ["/sbin/tini", "--", "/entrypoint.sh"]
342345

346+
# HEALTHCHECK --start-period=5s --interval=30s --timeout=5s --retries=3 CMD php artisan octane:status || exit 1
347+
348+
# # Override stop signal to stop process gracefully
349+
# STOPSIGNAL SIGQUIT
350+
343351
# set recommended PHP.ini settings
344352
# see https://secure.php.net/manual/en/opcache.installation.php
345353
RUN { \

php/docker-entrypoint.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,15 @@ php --ini
126126

127127
if [ "$CONTAINER_ROLE" = "APP" ]; then
128128

129-
exec php artisan serve --host=0.0.0.0 --port=8000
129+
if [[ ${WITH_OCTANE:-false} == true ]]; then
130+
printf "\033[34m[$CONTAINER_ROLE] Running with Laravel Octane ...\033[0m\n"
131+
132+
exec /usr/local/bin/php -d variables_order=EGPCS artisan octane:start --server=swoole --max-requests=100000 --host=0.0.0.0 --port=8000
133+
fi
134+
135+
printf "\033[34m[$CONTAINER_ROLE] Running with Laravel Serve ...\033[0m\n"
136+
137+
exec /usr/local/bin/php -d variables_order=GPCS artisan serve --host=0.0.0.0 --port=8000
130138

131139
elif [ "$CONTAINER_ROLE" = "QUEUE" ]; then
132140
printf "\n\033[34m[$CONTAINER_ROLE] Running the [QUEUE-WORKER] Service ...\033[0m\n"

0 commit comments

Comments
 (0)