Files
FrankandClaude Sonnet 5 9ba4197bfd Fix puzzle-relay crash loop: install pcntl/posix extensions
Workerman requires pcntl and posix on Linux; without them the relay
printed "Please install pcntl extension" and exited immediately,
Docker kept restarting it, and nginx's DNS lookups for
dmtools-puzzle-relay intermittently failed whenever it happened to be
down mid-restart - the "could not be resolved" errors were a symptom
of this crash loop, not a separate networking problem. Local dev never
hit this because Workerman's Windows code path doesn't need either
extension.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-12 13:49:07 +02:00

46 lines
1.5 KiB
Docker

FROM php:8.5-fpm-alpine
RUN apk add --no-cache bash git unzip
# Install PHP extensions with mlocati/php-extension-installer: it pulls the
# right system libraries itself, builds, and cleans up - much less fragile
# than hand-maintaining apk build deps.
COPY --from=mlocati/php-extension-installer:latest /usr/bin/install-php-extensions /usr/local/bin/
# pcntl and posix aren't needed by php-fpm itself, but the puzzle-relay
# service (docker-compose.yml) runs this same image as a Workerman process,
# and Workerman requires both on Linux (its Windows-only code path, the one
# used in local dev, doesn't need them - which is why this was missed there).
RUN install-php-extensions \
intl \
pdo_mysql \
opcache \
zip \
pcntl \
posix
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
COPY docker/php/php.ini /usr/local/etc/php/conf.d/app.ini
WORKDIR /var/www/html
COPY composer.json composer.lock symfony.lock ./
RUN composer install --no-interaction --no-scripts --no-autoloader --prefer-dist
COPY . .
RUN composer dump-autoload --optimize --classmap-authoritative
# var/ is a .dockerignore'd host concern and gets a named volume mounted over it
# at runtime; create + own it so php-fpm (www-data) can write cache/logs/sessions.
RUN mkdir -p var && chown -R www-data:www-data var
# /var/www/html is bind-mounted from the host at runtime, owned by whoever
# deployed it - keep git from refusing to touch it.
RUN git config --system --add safe.directory /var/www/html
USER www-data
EXPOSE 9000
CMD ["php-fpm"]