-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved from PHP-FPM to Octane + Swoole
- Loading branch information
1 parent
5c2756c
commit fe5757d
Showing
29 changed files
with
679 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ APP_PORT=9000 | |
XDEBUG_MODE=coverage | ||
|
||
SERVER_PORT=80 | ||
NGINX_LOGS_TO_LOGSTASH=false | ||
|
||
NODE_PORT=5173 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
#!/usr/bin/env sh | ||
|
||
set -e | ||
set -eu | ||
|
||
if [ "$APP_ENV" = "production" ]; then | ||
if [ "$NGINX_LOGS_TO_LOGSTASH" = "true" ]; then | ||
sed -i "s|access_log.*|access_log syslog:server=$LOGSTASH_URL logstash;|g" /etc/nginx/conf.d/default.conf | ||
sed -i "s|error_log.*|error_log syslog:server=$LOGSTASH_URL notice;|g" /etc/nginx/conf.d/default.conf | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,62 @@ | ||
# syntax=docker/dockerfile:1 | ||
|
||
ARG PHP_VERSION=8.3 | ||
ARG COMPOSER_VERSION=2.7.7 | ||
ARG NODE_VERSION=20.14 | ||
ARG PNPM_VERSION=9.3.0 | ||
|
||
FROM php:${PHP_VERSION}-fpm-alpine | ||
FROM node:${NODE_VERSION}-alpine AS node | ||
|
||
RUN --mount=type=cache,target=/root/.npm \ | ||
npm install -g pnpm@${PNPM_VERSION} | ||
|
||
FROM composer:${COMPOSER_VERSION} as composer | ||
|
||
FROM php:${PHP_VERSION}-cli-alpine | ||
|
||
ARG GROUP_ID=1000 | ||
ARG USER_ID=1000 | ||
|
||
RUN apk add --no-cache ${PHPIZE_DEPS} libzip-dev zip unzip git curl gmp-dev supervisor linux-headers \ | ||
&& pecl install xdebug \ | ||
&& docker-php-ext-install -j$(nproc) pdo_mysql zip exif pcntl bcmath gmp opcache \ | ||
&& docker-php-ext-enable xdebug \ | ||
&& addgroup -g ${GROUP_ID} anilibrary \ | ||
&& adduser -u ${USER_ID} -D -S -G anilibrary anilibrary \ | ||
&& apk del linux-headers ${PHPIZE_DEPS} | ||
RUN apk update \ | ||
&& apk add --no-cache libstdc++ libpq libzip-dev gmp-dev oniguruma-dev curl git zip unzip supervisor \ | ||
&& apk add --no-cache --virtual .build-deps $PHPIZE_DEPS linux-headers brotli-dev pcre-dev pcre2-dev zlib-dev \ | ||
&& pecl install xdebug swoole \ | ||
&& docker-php-ext-install -j$(nproc) \ | ||
pcntl \ | ||
mbstring \ | ||
bcmath \ | ||
sockets \ | ||
opcache \ | ||
exif \ | ||
pdo_mysql \ | ||
zip \ | ||
gmp \ | ||
&& docker-php-ext-enable xdebug swoole \ | ||
&& docker-php-source delete \ | ||
&& rm -rf /var/cache/apk/* /tmp/* /var/tmp/* \ | ||
&& apk del .build-deps | ||
|
||
RUN addgroup -g ${GROUP_ID} anilibrary \ | ||
&& adduser -u ${USER_ID} -D -S -G anilibrary anilibrary | ||
|
||
USER anilibrary | ||
|
||
COPY ./conf.d /usr/local/etc/php/conf.d | ||
COPY /supervisor/conf.d /etc/supervisor/conf.d | ||
COPY /supervisor/supervisord.conf /etc/supervisor/supervisord.conf | ||
COPY ./php.ini /usr/local/etc/php/php.ini | ||
COPY ./supervisor/conf.d /etc/supervisor/conf.d | ||
COPY ./supervisor/supervisord.conf /etc/supervisor/supervisord.conf | ||
|
||
COPY --from=composer /usr/bin/composer /usr/local/bin/composer | ||
|
||
USER anilibrary | ||
COPY --from=node /usr/lib /usr/lib | ||
COPY --from=node /usr/local/lib /usr/local/lib | ||
COPY --from=node /usr/local/include /usr/local/include | ||
COPY --from=node /usr/local/bin /usr/local/bin | ||
|
||
WORKDIR /anilibrary | ||
|
||
EXPOSE 8000 | ||
EXPOSE 5173 | ||
|
||
ENTRYPOINT ["supervisord", "-c", "/etc/supervisor/supervisord.conf"] | ||
|
||
WORKDIR /anilibrary | ||
HEALTHCHECK --start-period=5s --interval=2s --timeout=5s --retries=8 CMD php artisan octane:status || exit 1 |
Oops, something went wrong.