Skip to content

Commit 1f9cd51

Browse files
authored
Overhaul (#69)
Fixes #64 Prevents laravel/octane#791 Potentially fix for #66
1 parent 41253f3 commit 1f9cd51

File tree

8 files changed

+57
-25
lines changed

8 files changed

+57
-25
lines changed

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
/storage/ssr
1010
/storage/clockwork
1111
/storage/logs
12+
/storage/pail
1213
.phpunit.result.cache
1314
Homestead.json
1415
Homestead.yaml
@@ -30,3 +31,5 @@ _ide_helper.php
3031
rr
3132
.rr.yaml
3233
frankenphp
34+
.config
35+
.data

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
.vscode
22
.idea
3-
**/.DS_Store
3+
**/.DS_Store
4+
.config
5+
.data

FrankenPHP.Dockerfile

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Accepted values: 8.3 - 8.2
22
ARG PHP_VERSION=8.3
33

4-
ARG FRANKENPHP_VERSION=1.1-php${PHP_VERSION}
4+
ARG FRANKENPHP_VERSION=latest
55

66
ARG COMPOSER_VERSION=latest
77

@@ -36,9 +36,7 @@ RUN npm run build
3636

3737
FROM composer:${COMPOSER_VERSION} AS vendor
3838

39-
FROM dunglas/frankenphp:${FRANKENPHP_VERSION} AS server
40-
41-
FROM php:${PHP_VERSION}-zts-bookworm AS base
39+
FROM dunglas/frankenphp:${FRANKENPHP_VERSION}-php${PHP_VERSION}
4240

4341
LABEL maintainer="SMortexa <[email protected]>"
4442
LABEL org.opencontainers.image.title="Laravel Octane Dockerfile"
@@ -49,16 +47,19 @@ LABEL org.opencontainers.image.licenses=MIT
4947
ARG WWWUSER=1000
5048
ARG WWWGROUP=1000
5149
ARG TZ=UTC
50+
ARG APP_DIR=/var/www/html
5251

5352
ENV DEBIAN_FRONTEND=noninteractive \
5453
TERM=xterm-color \
5554
WITH_HORIZON=false \
5655
WITH_SCHEDULER=false \
5756
OCTANE_SERVER=frankenphp \
5857
USER=octane \
59-
ROOT=/var/www/html \
58+
ROOT=${APP_DIR} \
6059
COMPOSER_FUND=0 \
61-
COMPOSER_MAX_PARALLEL_HTTP=24
60+
COMPOSER_MAX_PARALLEL_HTTP=24 \
61+
XDG_CONFIG_HOME=${APP_DIR}/.config \
62+
XDG_DATA_HOME=${APP_DIR}/.data
6263

6364
WORKDIR ${ROOT}
6465

@@ -110,14 +111,14 @@ RUN wget -q "https://github.com/aptible/supercronic/releases/download/v0.2.29/su
110111
-O /usr/bin/supercronic \
111112
&& chmod +x /usr/bin/supercronic \
112113
&& mkdir -p /etc/supercronic \
113-
&& echo "*/1 * * * * php ${ROOT}/artisan schedule:run --verbose --no-interaction" > /etc/supercronic/laravel
114+
&& echo "*/1 * * * * php ${ROOT}/artisan schedule:run --no-interaction" > /etc/supercronic/laravel
114115

115116
RUN userdel --remove --force www-data \
116117
&& groupadd --force -g ${WWWGROUP} ${USER} \
117118
&& useradd -ms /bin/bash --no-log-init --no-user-group -g ${WWWGROUP} -u ${WWWUSER} ${USER}
118119

119120
RUN chown -R ${USER}:${USER} ${ROOT} /var/{log,run} \
120-
&& chmod -R a+rw /var/{log,run}
121+
&& chmod -R a+rw ${ROOT} /var/{log,run}
121122

122123
RUN cp ${PHP_INI_DIR}/php.ini-production ${PHP_INI_DIR}/php.ini
123124

@@ -158,9 +159,7 @@ RUN composer install \
158159
&& composer clear-cache \
159160
&& php artisan storage:link
160161

161-
COPY --chown=${USER}:${USER} --from=server /usr/local/bin/frankenphp ./frankenphp
162-
163-
RUN chmod +x /usr/local/bin/start-container frankenphp
162+
RUN chmod +x /usr/local/bin/start-container
164163

165164
RUN cat deployment/utilities.sh >> ~/.bashrc
166165

RoadRunner.Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,14 @@ RUN wget -q "https://github.com/aptible/supercronic/releases/download/v0.2.29/su
106106
-O /usr/bin/supercronic \
107107
&& chmod +x /usr/bin/supercronic \
108108
&& mkdir -p /etc/supercronic \
109-
&& echo "*/1 * * * * php ${ROOT}/artisan schedule:run --verbose --no-interaction" > /etc/supercronic/laravel
109+
&& echo "*/1 * * * * php ${ROOT}/artisan schedule:run --no-interaction" > /etc/supercronic/laravel
110110

111111
RUN userdel --remove --force www-data \
112112
&& groupadd --force -g ${WWWGROUP} ${USER} \
113113
&& useradd -ms /bin/bash --no-log-init --no-user-group -g ${WWWGROUP} -u ${WWWUSER} ${USER}
114114

115115
RUN chown -R ${USER}:${USER} ${ROOT} /var/{log,run} \
116-
&& chmod -R a+rw /var/{log,run}
116+
&& chmod -R a+rw ${ROOT} /var/{log,run}
117117

118118
RUN cp ${PHP_INI_DIR}/php.ini-production ${PHP_INI_DIR}/php.ini
119119

Swoole.Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,14 @@ RUN wget -q "https://github.com/aptible/supercronic/releases/download/v0.2.29/su
107107
-O /usr/bin/supercronic \
108108
&& chmod +x /usr/bin/supercronic \
109109
&& mkdir -p /etc/supercronic \
110-
&& echo "*/1 * * * * php ${ROOT}/artisan schedule:run --verbose --no-interaction" > /etc/supercronic/laravel
110+
&& echo "*/1 * * * * php ${ROOT}/artisan schedule:run --no-interaction" > /etc/supercronic/laravel
111111

112112
RUN userdel --remove --force www-data \
113113
&& groupadd --force -g ${WWWGROUP} ${USER} \
114114
&& useradd -ms /bin/bash --no-log-init --no-user-group -g ${WWWGROUP} -u ${WWWUSER} ${USER}
115115

116116
RUN chown -R ${USER}:${USER} ${ROOT} /var/{log,run} \
117-
&& chmod -R a+rw /var/{log,run}
117+
&& chmod -R a+rw ${ROOT} /var/{log,run}
118118

119119
RUN cp ${PHP_INI_DIR}/php.ini-production ${PHP_INI_DIR}/php.ini
120120

deployment/octane/FrankenPHP/supervisord.frankenphp.conf

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ pidfile=/var/run/supervisord.pid
77
[program:octane]
88
process_name=%(program_name)s_%(process_num)02d
99
command=php %(ENV_ROOT)s/artisan octane:start --server=frankenphp --host=0.0.0.0 --port=80 --admin-port=2019
10+
# command=php %(ENV_ROOT)s/artisan octane:start --server=frankenphp --host=localhost --port=443 --admin-port=2019 --https --http-redirect
1011
user=%(ENV_USER)s
1112
autostart=true
1213
autorestart=true
@@ -22,7 +23,10 @@ command=php %(ENV_ROOT)s/artisan horizon
2223
user=%(ENV_USER)s
2324
autostart=%(ENV_WITH_HORIZON)s
2425
autorestart=true
25-
stdout_logfile=%(ENV_ROOT)s/horizon.log
26+
stdout_logfile=%(ENV_ROOT)s/storage/logs/horizon.log
27+
stdout_logfile_maxbytes=0
28+
stderr_logfile=%(ENV_ROOT)s/storage/logs/horizon.log
29+
stderr_logfile_maxbytes=0
2630
stopwaitsecs=3600
2731

2832
[program:scheduler]
@@ -31,12 +35,18 @@ command=supercronic -overlapping /etc/supercronic/laravel
3135
user=%(ENV_USER)s
3236
autostart=%(ENV_WITH_SCHEDULER)s
3337
autorestart=true
34-
stdout_logfile=%(ENV_ROOT)s/scheduler.log
38+
stdout_logfile=%(ENV_ROOT)s/storage/logs/scheduler.log
39+
stdout_logfile_maxbytes=0
40+
stderr_logfile=%(ENV_ROOT)s/storage/logs/scheduler.log
41+
stderr_logfile_maxbytes=0
3542

3643
[program:clear-scheduler-cache]
3744
process_name=%(program_name)s_%(process_num)02d
3845
command=php %(ENV_ROOT)s/artisan schedule:clear-cache
3946
user=%(ENV_USER)s
4047
autostart=%(ENV_WITH_SCHEDULER)s
4148
autorestart=false
42-
stdout_logfile=%(ENV_ROOT)s/scheduler.log
49+
stdout_logfile=%(ENV_ROOT)s/storage/logs/scheduler.log
50+
stdout_logfile_maxbytes=0
51+
stderr_logfile=%(ENV_ROOT)s/storage/logs/scheduler.log
52+
stderr_logfile_maxbytes=0

deployment/octane/RoadRunner/supervisord.roadrunner.conf

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ command=php %(ENV_ROOT)s/artisan horizon
2222
user=%(ENV_USER)s
2323
autostart=%(ENV_WITH_HORIZON)s
2424
autorestart=true
25-
stdout_logfile=%(ENV_ROOT)s/horizon.log
25+
stdout_logfile=%(ENV_ROOT)s/storage/logs/horizon.log
26+
stdout_logfile_maxbytes=0
27+
stderr_logfile=%(ENV_ROOT)s/storage/logs/horizon.log
28+
stderr_logfile_maxbytes=0
2629
stopwaitsecs=3600
2730

2831
[program:scheduler]
@@ -31,12 +34,18 @@ command=supercronic -overlapping /etc/supercronic/laravel
3134
user=%(ENV_USER)s
3235
autostart=%(ENV_WITH_SCHEDULER)s
3336
autorestart=true
34-
stdout_logfile=%(ENV_ROOT)s/scheduler.log
37+
stdout_logfile=%(ENV_ROOT)s/storage/logs/scheduler.log
38+
stdout_logfile_maxbytes=0
39+
stderr_logfile=%(ENV_ROOT)s/storage/logs/scheduler.log
40+
stderr_logfile_maxbytes=0
3541

3642
[program:clear-scheduler-cache]
3743
process_name=%(program_name)s_%(process_num)02d
3844
command=php %(ENV_ROOT)s/artisan schedule:clear-cache
3945
user=%(ENV_USER)s
4046
autostart=%(ENV_WITH_SCHEDULER)s
4147
autorestart=false
42-
stdout_logfile=%(ENV_ROOT)s/scheduler.log
48+
stdout_logfile=%(ENV_ROOT)s/storage/logs/scheduler.log
49+
stdout_logfile_maxbytes=0
50+
stderr_logfile=%(ENV_ROOT)s/storage/logs/scheduler.log
51+
stderr_logfile_maxbytes=0

deployment/octane/Swoole/supervisord.swoole.conf

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ command=php %(ENV_ROOT)s/artisan horizon
2222
user=%(ENV_USER)s
2323
autostart=%(ENV_WITH_HORIZON)s
2424
autorestart=true
25-
stdout_logfile=%(ENV_ROOT)s/horizon.log
25+
stdout_logfile=%(ENV_ROOT)s/storage/logs/horizon.log
26+
stdout_logfile_maxbytes=0
27+
stderr_logfile=%(ENV_ROOT)s/storage/logs/horizon.log
28+
stderr_logfile_maxbytes=0
2629
stopwaitsecs=3600
2730

2831
[program:scheduler]
@@ -31,12 +34,18 @@ command=supercronic -overlapping /etc/supercronic/laravel
3134
user=%(ENV_USER)s
3235
autostart=%(ENV_WITH_SCHEDULER)s
3336
autorestart=true
34-
stdout_logfile=%(ENV_ROOT)s/scheduler.log
37+
stdout_logfile=%(ENV_ROOT)s/storage/logs/scheduler.log
38+
stdout_logfile_maxbytes=0
39+
stderr_logfile=%(ENV_ROOT)s/storage/logs/scheduler.log
40+
stderr_logfile_maxbytes=0
3541

3642
[program:clear-scheduler-cache]
3743
process_name=%(program_name)s_%(process_num)02d
3844
command=php %(ENV_ROOT)s/artisan schedule:clear-cache
3945
user=%(ENV_USER)s
4046
autostart=%(ENV_WITH_SCHEDULER)s
4147
autorestart=false
42-
stdout_logfile=%(ENV_ROOT)s/scheduler.log
48+
stdout_logfile=%(ENV_ROOT)s/storage/logs/scheduler.log
49+
stdout_logfile_maxbytes=0
50+
stderr_logfile=%(ENV_ROOT)s/storage/logs/scheduler.log
51+
stderr_logfile_maxbytes=0

0 commit comments

Comments
 (0)