-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
71 lines (61 loc) · 2.2 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# Use the official PHP 8.2 image with FPM
FROM php:8.2-fpm
# Install dependencies
RUN apt-get update && apt-get install -y \
vim \
nginx \
gzip \
lsof \
mariadb-client \
default-mysql-client \
sed \
tar \
libpng-dev \
libjpeg-dev \
libfreetype6-dev \
libonig-dev \
libicu-dev \
libxml2-dev \
libxslt-dev \
libzip-dev \
zip \
unzip \
git \
libcurl4-openssl-dev \
curl \
libmagickwand-dev \
libssl-dev \
libpcre3-dev \
--no-install-recommends
# Install PHP extensions not included in the base image
RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install gd \
&& docker-php-ext-install intl \
&& docker-php-ext-install bcmath \
&& docker-php-ext-install pdo_mysql \
&& docker-php-ext-install soap \
&& docker-php-ext-install sockets \
&& docker-php-ext-install xsl \
&& docker-php-ext-install zip
# Install and enable PECL extensions
RUN pecl install redis && docker-php-ext-enable redis \
&& pecl install imagick && docker-php-ext-enable imagick
# Install xdebug
RUN pecl install xdebug && docker-php-ext-enable xdebug
# Modify the memory limit in the php.ini file
RUN sed -i 's/memory_limit = .*/memory_limit = 4G/' /usr/local/etc/php/php.ini-development \
&& cp /usr/local/etc/php/php.ini-development /usr/local/etc/php/php.ini
# Add xdebug settings, "zend_extension=xdebug" is alread set
RUN echo "xdebug.mode=develop,debug" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.start_with_request=yes" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.discover_client_host=0" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.client_host=host.docker.internal" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.client_port=9003" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.log=/tmp/xdebug.log" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
# Install Composer
COPY --from=composer:2.2 /usr/bin/composer /usr/bin/composer
# Set working directory
WORKDIR /var/www/html
# Expose port 9000 for PHP-FPM
EXPOSE 9000
CMD ["php-fpm"]