Files
max-bot-test/Dockerfile
pkirillw e4dcf0da5b
All checks were successful
Deploy Max Bot Test / deploy (push) Successful in 38s
fix(docker): align www-data UID/GID with host (1000:1000)
php-fpm runs workers as www-data, so master stays root and drops to a UID matching host files. storage bind-mount is writable without runtime chmod hacks.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-18 00:41:51 +03:00

38 lines
1009 B
Docker

FROM php:8.4-fpm-alpine AS base
ARG HOST_UID=1000
ARG HOST_GID=1000
RUN apk add --no-cache \
libzip-dev \
zlib-dev \
unzip \
git \
curl \
shadow \
&& docker-php-ext-install zip pcntl \
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
&& groupmod -g $HOST_GID www-data \
&& usermod -u $HOST_UID -g $HOST_GID www-data
WORKDIR /var/www/html
# --- builder: composer install without dev deps, no scripts ---
FROM base AS builder
COPY composer.json composer.lock ./
RUN composer install --no-dev --no-scripts --no-plugins --prefer-dist --no-interaction
# --- runtime: copy app code on top of vendor/ ---
FROM base AS runtime
COPY --from=builder /var/www/html/vendor /var/www/html/vendor
COPY composer.json composer.lock ./
COPY bin ./bin
COPY config ./config
COPY public ./public
COPY src ./src
COPY storage ./storage
RUN chown -R www-data:www-data /var/www/html/storage
CMD ["php-fpm"]