-
Notifications
You must be signed in to change notification settings - Fork 193
/
Copy pathDockerfile
180 lines (159 loc) · 5.53 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# This file is automatically generated. Do not edit directly. #
FROM golang:1.15 AS builder
RUN if [ $(uname -m) = "x86_64" ]; then mailhog_arch="amd64"; else mailhog_arch="arm64"; fi \
&& wget -O mhsendmail.tar.gz https://github.com/mailhog/mhsendmail/archive/refs/tags/v0.2.0.tar.gz \
&& tar -xf mhsendmail.tar.gz \
&& mkdir -p ./src/github.com/mailhog/ \
&& mv ./mhsendmail-0.2.0 ./src/github.com/mailhog/mhsendmail \
&& cd ./src/github.com/mailhog/mhsendmail/ \
&& go get . \
&& GOOS=linux GOARCH=${mailhog_arch} go build -o mhsendmail .
FROM php:8.1.1-fpm
ARG MAGENTO_ROOT=/app
ENV PHP_MEMORY_LIMIT 2G
ENV PHP_VALIDATE_TIMESTAMPS 1
ENV DEBUG false
ENV MAGENTO_RUN_MODE production
ENV UPLOAD_MAX_FILESIZE 64M
ENV SENDMAIL_PATH /dev/null
ENV PHPRC ${MAGENTO_ROOT}/php.ini
ENV PHP_EXTENSIONS bcmath bz2 calendar exif gd gettext imagick intl mysqli opcache pdo_mysql redis soap sockets sodium sysvmsg sysvsem sysvshm xsl zip pcntl
# Install dependencies
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y --no-install-recommends \
apt-utils \
sendmail-bin \
sendmail \
sudo \
iproute2 \
git \
gnupg2 \
ca-certificates \
lsb-release \
software-properties-common \
libbz2-dev \
libjpeg62-turbo-dev \
libpng-dev \
libfreetype6-dev \
libwebp-dev \
libgmp-dev \
libgpgme11-dev \
libmagickwand-dev \
libmagickcore-dev \
libicu-dev \
libldap2-dev \
libpcre3-dev \
libpspell-dev \
libtidy-dev \
libxslt1-dev \
libyaml-dev \
libzip-dev \
zip \
&& rm -rf /var/lib/apt/lists/*
# Install MailHog
COPY --from=builder /go/src/github.com/mailhog/mhsendmail/mhsendmail /usr/local/bin/
RUN sudo chmod +x /usr/local/bin/mhsendmail
# Configure the gd library
RUN docker-php-ext-configure \
gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ --with-webp=/usr/include/
RUN docker-php-ext-configure \
opcache --enable-opcache
# Install required PHP extensions
RUN docker-php-ext-install -j$(nproc) \
bcmath \
bz2 \
calendar \
exif \
gd \
gettext \
gmp \
intl \
mysqli \
opcache \
pdo_mysql \
pspell \
shmop \
soap \
sockets \
sysvmsg \
sysvsem \
sysvshm \
tidy \
xsl \
zip \
pcntl
RUN pecl install -o -f \
gnupg \
imagick \
mailparse \
msgpack \
oauth \
pcov \
raphf \
redis \
xdebug-3.1.2 \
xmlrpc-1.0.0RC3 \
yaml
RUN curl -L https://packages.blackfire.io/gpg.key | gpg --dearmor > blackfire.io-archive-keyring.gpg \
&& install -o root -g root -m 644 blackfire.io-archive-keyring.gpg /etc/apt/trusted.gpg.d/ \
&& echo "deb http://packages.blackfire.io/debian any main" | tee /etc/apt/sources.list.d/blackfire.list \
&& apt-get update \
&& apt-get install blackfire-php \
&& rm -rf /var/lib/apt/lists/*
RUN if [ $(uname -m) = "x86_64" ]; then ldap_arch="x86_64-linux-gnu"; else ldap_arch="aarch64-linux-gnu"; fi \
&& docker-php-ext-configure ldap --with-libdir=lib/${ldap_arch}
RUN mkdir -p /tmp/zoo \
&& cd /tmp/zoo \
&& git clone https://github.com/php-zookeeper/php-zookeeper.git \
&& curl -LO https://archive.apache.org/dist/zookeeper/zookeeper-3.4.14/zookeeper-3.4.14.tar.gz \
&& tar -xf zookeeper-3.4.14.tar.gz \
&& cp zookeeper-3.4.14/zookeeper-client/zookeeper-client-c/generated/zookeeper.jute.h zookeeper-3.4.14/zookeeper-client/zookeeper-client-c/include \
&& cd zookeeper-3.4.14/zookeeper-client/zookeeper-client-c \
&& ./configure \
&& sed -i 's/CFLAGS = -g -O2 -D_GNU_SOURCE/CFLAGS = -g -O2 -D_GNU_SOURCE -Wno-error=format-overflow -Wno-error=stringop-truncation/g' Makefile \
&& make \
&& make install \
&& ldconfig \
&& cd /tmp/zoo/php-zookeeper \
&& phpize \
&& ./configure --with-libzookeeper-dir=../zookeeper-3.4.14/zookeeper-client/zookeeper-client-c \
&& make \
&& make install
RUN rm -f /usr/local/etc/php/conf.d/*sodium.ini \
&& rm -f /usr/local/lib/php/extensions/*/*sodium.so \
&& apt-get remove libsodium* -y \
&& mkdir -p /tmp/libsodium \
&& curl -sL https://github.com/jedisct1/libsodium/archive/1.0.18-RELEASE.tar.gz | tar xzf - -C /tmp/libsodium \
&& cd /tmp/libsodium/libsodium-1.0.18-RELEASE/ \
&& ./configure \
&& make && make check \
&& make install \
&& cd / \
&& rm -rf /tmp/libsodium \
&& pecl install -o -f libsodium
RUN cd /tmp \
&& if [ $(uname -m) = "x86_64" ]; then ioncube_arch="x86-64"; else ioncube_arch="aarch64"; fi \
&& curl -O https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_${ioncube_arch}.tar.gz \
&& tar zxvf ioncube_loaders_lin_${ioncube_arch}.tar.gz \
&& export PHP_VERSION=$(php -r "echo PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;") \
&& export PHP_EXT_DIR=$(php-config --extension-dir) \
&& cp "./ioncube/ioncube_loader_lin_${PHP_VERSION}.so" "${PHP_EXT_DIR}/ioncube.so" \
&& rm -rf ./ioncube \
&& rm ioncube_loaders_lin_${ioncube_arch}.tar.gz
COPY etc/php-fpm.ini /usr/local/etc/php/conf.d/zz-magento.ini
COPY etc/php-xdebug.ini /usr/local/etc/php/conf.d/zz-xdebug-settings.ini
COPY etc/php-pcov.ini /usr/local/etc/php/conf.d/zz-pcov-settings.ini
COPY etc/mail.ini /usr/local/etc/php/conf.d/zz-mail.ini
COPY etc/php-fpm.conf /usr/local/etc/
COPY etc/php-gnupg.ini /usr/local/etc/php/conf.d/gnupg.ini
RUN groupadd -g 1000 www && useradd -g 1000 -u 1000 -d ${MAGENTO_ROOT} -s /bin/bash www
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN ["chmod", "+x", "/docker-entrypoint.sh"]
RUN mkdir -p ${MAGENTO_ROOT}
VOLUME ${MAGENTO_ROOT}
RUN chown -R www:www /usr/local /var/www /var/log /usr/local/etc/php/conf.d ${MAGENTO_ROOT}
ENTRYPOINT ["/docker-entrypoint.sh"]
WORKDIR ${MAGENTO_ROOT}
USER root
CMD ["php-fpm", "-R"]