-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathContainerfile.71
57 lines (51 loc) · 3.05 KB
/
Containerfile.71
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
# docker build --file Containerfile.71 --tag ghcr.io/themecraftstudio/php-fpm:7.1 .
FROM php:7.1-fpm-alpine AS builder
ENV CPPFLAGS -Ofast -falign-functions=32 -fno-lto -fno-semantic-interposition -mno-vzeroupper -mprefer-vector-width=256 -march=x86-64
ENV LDFLAGS -s
ENV PHP_BUILD_DEPS git file autoconf pkgconf dpkg dpkg-dev make g++ re2c libc-dev libxml2-dev openssl-dev libedit-dev libzip-dev bzip2-dev curl-dev libpng-dev libjpeg-turbo-dev libwebp-dev gmp-dev icu-dev oniguruma-dev libxslt-dev
RUN apk update && apk upgrade && apk add --virtual .php-deps-dev ${PHP_BUILD_DEPS}
RUN docker-php-source extract
WORKDIR /usr/src/php
RUN rm -rf /usr/local/bin/p* /usr/local/sbin/* /usr/local/lib/php
RUN ./configure --enable-option-checking=fatal --build=x86_64-linux-musl \
--prefix=/usr/local --with-config-file-path=/etc/php --with-config-file-scan-dir=/etc/php/conf.d \
--enable-cli --enable-fpm --with-fpm-user=apache --with-fpm-group=apache --disable-cgi --disable-short-tags \
--with-openssl --with-system-ciphers \
--enable-mysqlnd --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --without-sqlite3 --without-pdo-sqlite \
--enable-zip --with-zlib --with-bz2 \
--enable-bcmath --with-gmp --enable-mbstring --with-iconv \
--with-gd --enable-exif \
--enable-calendar --enable-intl --enable-pcntl --enable-shmop --enable-re2c-cgoto --enable-soap --enable-sockets --with-curl --with-libedit --with-xsl
RUN make --jobs=$(nproc)
RUN make install
ENV PHP_EXT_APCU_SRC https://github.com/krakjoe/apcu/archive/refs/heads/master.tar.gz
RUN mkdir -p /usr/src/apcu && cd /usr/src/apcu && curl --location ${PHP_EXT_APCU_SRC} | tar xzf - --strip-components=1
RUN cd /usr/src/apcu && phpize \
&& ./configure --with-php-config=/usr/local/bin/php-config --enable-option-checking=fatal \
&& make --jobs=$(nproc) \
&& make install
ENTRYPOINT ["/bin/sh"]
# Create the image
FROM alpine:3.10
ENV XDEBUG_REMOTE_HOST host.docker.internal
RUN apk upgrade --no-cache --purge \
&& apk add --no-cache --virtual .php-deps libxml2 openssl libedit libbz2 libcurl libpng libjpeg-turbo libwebp libgomp gmp icu-libs oniguruma libzip libxslt \
&& apk add --no-cache apache2 apache2-proxy \
&& mkdir -p /var/www/app && chown apache:apache /var/www/app
COPY --from=builder /usr/local/bin/phar /usr/local/bin/
COPY --from=builder /usr/local/bin/phar.phar /usr/local/bin/
COPY --from=builder /usr/local/bin/php /usr/local/bin/
COPY --from=builder /usr/local/bin/php-config /usr/local/bin/
COPY --from=builder /usr/local/lib/php/extensions/ /usr/local/lib/php/extensions/
COPY --from=builder /usr/local/sbin/php-fpm /usr/local/sbin/
ADD conf/php-fpm.conf /etc/php/php-fpm.conf
ADD conf/php.ini /etc/php/php.ini
ADD conf/apache.conf /etc/apache2/httpd.conf
ADD entry.sh /usr/local/bin/docker-entry.sh
ADD reload.sh /usr/local/bin/reload.sh
ENTRYPOINT ["/usr/local/bin/docker-entry.sh"]
# CMD ["--nodaemonize"]
EXPOSE 9000/tcp
EXPOSE 80/tcp
LABEL org.opencontainers.image.source https://github.com/themecraftstudio/docker-php-fpm
LABEL org.opencontainers.image.description Production-ready PHP-FPM image for containerized web apps