Files
termanager2/docker/php/Dockerfile
root d38d8b7896 Add Docker entrypoint and cleanup gitignore
- Add entrypoint.sh for automated app initialization (composer, npm, migrations, cache)
- Update Dockerfile: run entrypoint as root, php-fpm workers still run as appuser
- Update .gitignore: exclude storage/logs, storage/framework, bootstrap/cache, public/build
- Remove generated/cached files from git tracking
2026-04-05 19:50:55 +02:00

69 lines
1.5 KiB
Docker

FROM php:8.3-fpm
ARG USER_ID=1000
ARG GROUP_ID=1000
# System dependencies
RUN apt-get update && apt-get install -y \
git \
curl \
libpng-dev \
libjpeg62-turbo-dev \
libfreetype6-dev \
libonig-dev \
libxml2-dev \
libzip-dev \
libicu-dev \
zip \
unzip \
supervisor \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install \
pdo_mysql \
mbstring \
exif \
pcntl \
bcmath \
gd \
intl \
zip \
opcache \
&& pecl install redis \
&& docker-php-ext-enable redis \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install Composer
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
# Install Node.js 20 LTS
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y nodejs \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Create system user
RUN groupadd -g ${GROUP_ID} appuser \
&& useradd -u ${USER_ID} -g appuser -m appuser
# Set working directory
WORKDIR /var/www/html
# Copy PHP configuration
COPY php.ini /usr/local/etc/php/conf.d/custom.ini
# Copy PHP-FPM pool config (run workers as appuser)
COPY www.conf /usr/local/etc/php-fpm.d/www.conf
# Copy entrypoint
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
# Set ownership
RUN chown -R appuser:appuser /var/www/html
EXPOSE 9000
ENTRYPOINT ["entrypoint.sh"]
CMD ["php-fpm"]