PHP 8.4 environment
This commit is contained in:
13 files changed
+342
No files matched your search
@@ -0,0 +1,77 @@
|
||||
FROM php:8.4-fpm-alpine3.21
|
||||
|
||||
ARG UID=1000
|
||||
ARG GID=1000
|
||||
ARG DEBUG=false
|
||||
ARG BUILD_MODE=prod
|
||||
|
||||
# Custom prompt
|
||||
ENV PS1="\033[01;32mapp\033[00m:\033[01;34m\w\033[00m\$ \033[37m"
|
||||
|
||||
# Install packages
|
||||
RUN apk add --update --no-cache \
|
||||
linux-headers \
|
||||
curl \
|
||||
curl-dev \
|
||||
git \
|
||||
build-base \
|
||||
libpq-dev \
|
||||
libpng-dev \
|
||||
libzip-dev \
|
||||
zlib-dev \
|
||||
oniguruma-dev \
|
||||
autoconf \
|
||||
nginx \
|
||||
bash \
|
||||
shadow \
|
||||
make
|
||||
|
||||
# Install PHP extensions
|
||||
RUN docker-php-ext-install \
|
||||
pdo_pgsql \
|
||||
bcmath \
|
||||
curl \
|
||||
exif \
|
||||
zip \
|
||||
bz2 \
|
||||
gd
|
||||
|
||||
# Configure non-root user
|
||||
RUN groupmod -o -g ${GID} www-data && \
|
||||
usermod -o -u ${UID} -g www-data www-data
|
||||
|
||||
# Copy application
|
||||
WORKDIR /app
|
||||
RUN chown www-data:www-data /app
|
||||
COPY --chown=www-data:www-data ./ /app
|
||||
|
||||
# Configure Xdebug
|
||||
RUN if [ ${DEBUG} = "true" ]; \
|
||||
then \
|
||||
pecl install xdebug && docker-php-ext-enable xdebug; \
|
||||
fi;
|
||||
COPY ./docker/conf/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
|
||||
|
||||
# Install composer
|
||||
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
||||
|
||||
# Install php dependencies
|
||||
RUN if [ ${BUILD_MODE} = "prod" ]; \
|
||||
then \
|
||||
composer install --no-dev --no-interaction --no-progress --no-scripts --optimize-autoloader; \
|
||||
chown -R www-data:www-data /app/vendor/; \
|
||||
fi;
|
||||
|
||||
# Configure nginx
|
||||
RUN touch /var/lib/nginx/logs/error.log && chown www-data:www-data /var/lib/nginx/logs/error.log
|
||||
RUN chown -Rf www-data:www-data /var/lib/nginx /run
|
||||
COPY ./docker/conf/nginx.conf /etc/nginx/
|
||||
|
||||
COPY ./docker/entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
USER www-data
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
CMD ["/entrypoint.sh"]
|
||||
Reference in new issue
Block a user