Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
smortexa committed Jan 18, 2024
1 parent 3555ddb commit a2ba1e0
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 13 deletions.
11 changes: 5 additions & 6 deletions FrankenPHP.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
# Accepted values: 8.3 - 8.2 - 8.1
ARG PHP_VERSION=8.2

ARG NODE_VERSION=20-alpine

ARG COMPOSER_VERSION=latest

FROM composer:${COMPOSER_VERSION} AS vendor

###########################################
# Build frontend assets with NPM
###########################################

ARG NODE_VERSION=20-alpine

FROM node:${NODE_VERSION} as build

ENV ROOT=/var/www/html
Expand All @@ -34,6 +32,8 @@ RUN npm run build

###########################################

FROM composer:${COMPOSER_VERSION} AS vendor

FROM php:${PHP_VERSION}-cli-bookworm

LABEL maintainer="SMortexa <[email protected]>"
Expand Down Expand Up @@ -175,8 +175,7 @@ RUN mkdir -p \
bootstrap/cache

COPY --chown=${NON_ROOT_USER}:${NON_ROOT_USER} deployment/octane/FrankenPHP/supervisord.frankenphp.conf /etc/supervisor/conf.d/
COPY --chown=${NON_ROOT_USER}:${NON_ROOT_USER} deployment/supervisord.scheduler.conf /etc/supervisor/conf.d/
COPY --chown=${NON_ROOT_USER}:${NON_ROOT_USER} deployment/supervisord.horizon.conf /etc/supervisor/conf.d/
COPY --chown=${NON_ROOT_USER}:${NON_ROOT_USER} deployment/supervisord.*.conf /etc/supervisor/conf.d/
COPY --chown=${NON_ROOT_USER}:${NON_ROOT_USER} deployment/start-container /usr/local/bin/start-container
COPY --chown=${NON_ROOT_USER}:${NON_ROOT_USER} deployment/php.ini /usr/local/etc/php/conf.d/99-octane.ini

Expand Down
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,17 @@ docker run -e CONTAINER_MODE=horizon --rm <image-name>:<tag>
# Scheduler mode
docker run -e CONTAINER_MODE=scheduler --rm <image-name>:<tag>

# http mode with Horizon
# HTTP mode with Horizon
docker run -e WITH_HORIZON=true -p <port>:80 --rm <image-name>:<tag>

# http mode with Scheduler
# HTTP mode with Scheduler
docker run -e WITH_SCHEDULER=true -p <port>:80 --rm <image-name>:<tag>

# Worker mode
docker run -e CONTAINER_MODE=worker -e WORKER_COMMAND="php /var/www/html/artisan foo:bar" --rm <image-name>:<tag>

# Running a single command
docker run --rm <image-name>:<tag> php artisan about
```

## Configuration
Expand Down Expand Up @@ -90,7 +96,7 @@ Also, some useful Bash functions and aliases are added in `utilities.sh` that ma

## ToDo
- [x] Add support for PHP 8.3
- [ ] Add support for worker mode
- [x] Add support for worker mode
- [ ] Build assets with Bun
- [ ] Create standalone and self-executable app
- [x] Add support for Horizon
Expand Down
3 changes: 1 addition & 2 deletions RoadRunner.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,7 @@ RUN mkdir -p \
bootstrap/cache

COPY --chown=${NON_ROOT_USER}:${NON_ROOT_USER} deployment/octane/RoadRunner/supervisord.roadrunner.conf /etc/supervisor/conf.d
COPY --chown=${NON_ROOT_USER}:${NON_ROOT_USER} deployment/supervisord.scheduler.conf /etc/supervisor/conf.d/
COPY --chown=${NON_ROOT_USER}:${NON_ROOT_USER} deployment/supervisord.horizon.conf /etc/supervisor/conf.d/
COPY --chown=${NON_ROOT_USER}:${NON_ROOT_USER} deployment/supervisord.*.conf /etc/supervisor/conf.d/
COPY --chown=${NON_ROOT_USER}:${NON_ROOT_USER} deployment/php.ini /usr/local/etc/php/conf.d/99-octane.ini
COPY --chown=${NON_ROOT_USER}:${NON_ROOT_USER} deployment/octane/RoadRunner/.rr.prod.yaml ./.rr.yaml
COPY --chown=${NON_ROOT_USER}:${NON_ROOT_USER} deployment/start-container /usr/local/bin/start-container
Expand Down
3 changes: 1 addition & 2 deletions Swoole.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,7 @@ RUN mkdir -p \
bootstrap/cache

COPY --chown=${NON_ROOT_USER}:${NON_ROOT_USER} deployment/octane/Swoole/supervisord.swoole.conf /etc/supervisor/conf.d/
COPY --chown=${NON_ROOT_USER}:${NON_ROOT_USER} deployment/supervisord.scheduler.conf /etc/supervisor/conf.d/
COPY --chown=${NON_ROOT_USER}:${NON_ROOT_USER} deployment/supervisord.horizon.conf /etc/supervisor/conf.d/
COPY --chown=${NON_ROOT_USER}:${NON_ROOT_USER} deployment/supervisord.*.conf /etc/supervisor/conf.d/
COPY --chown=${NON_ROOT_USER}:${NON_ROOT_USER} deployment/php.ini /usr/local/etc/php/conf.d/99-octane.ini
COPY --chown=${NON_ROOT_USER}:${NON_ROOT_USER} deployment/start-container /usr/local/bin/start-container

Expand Down
3 changes: 3 additions & 0 deletions deployment/start-container
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ elif [ ${container_mode} = "horizon" ]; then
elif [ ${container_mode} = "scheduler" ]; then
initialStuff
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.scheduler.conf
elif [ ${container_mode} = "worker" ]; then
initialStuff
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.worker.conf
else
echo "Container mode mismatched."
exit 1
Expand Down
17 changes: 17 additions & 0 deletions deployment/supervisord.worker.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[supervisord]
nodaemon=true
user=%(ENV_NON_ROOT_USER)s
logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid

[program:worker]
process_name=%(program_name)s_%(process_num)02d
command=%(ENV_WORKER_COMMAND)s
user=%(ENV_NON_ROOT_USER)s
autostart=true
autorestart=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
stopwaitsecs=3600

0 comments on commit a2ba1e0

Please sign in to comment.