Skip to content

Commit c34c4a3

Browse files
committed
First commit to master branch version 5.6
0 parents  commit c34c4a3

26 files changed

+1403
-0
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.idea
2+
.env

.travis.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
language: bash
2+
3+
dist: trusty
4+
5+
sudo: required
6+
7+
services:
8+
- docker
9+
10+
env:
11+
global:
12+
- COMMIT=${TRAVIS_COMMIT::8}
13+
- REPO=dockerframework/phpfpm:3.0
14+
- CGO_ENABLED=0
15+
- GOOS=linux
16+
- GOARCH=amd64
17+
18+
before_install:
19+
- sudo chmod +x ./tests/docker_tests.sh
20+
- sudo chmod +x ./tests/docker_run.sh
21+
- sudo apt-get update
22+
- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
23+
- echo 'DOCKER_OPTS="-H tcp://127.0.0.1:2375 -H unix:///var/run/docker.sock -s devicemapper"' | sudo tee /etc/default/docker > /dev/null
24+
- sudo service docker restart
25+
- sleep 3
26+
27+
script:
28+
- ./tests/docker_tests.sh
29+
- ./tests/docker_run.sh

Dockerfile

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
ARG PHP_VERSION=5.6.35
2+
ARG ALPINE_VERSION=3.4
3+
FROM ${PHP_VERSION}-fpm-alpine${ALPINE_VERSION}
4+
5+
# ================================================================================================
6+
# Inspiration: Docker Framework (https://github.com/zeroc0d3/docker-framework)
7+
# Dwi Fahni Denni <[email protected]>
8+
# ================================================================================================
9+
# Core Contributors:
10+
# - Mahmoud Zalt @mahmoudz
11+
# - Bo-Yi Wu @appleboy
12+
# - Philippe Trépanier @philtrep
13+
# - Mike Erickson @mikeerickson
14+
# - Dwi Fahni Denni @zeroc0d3
15+
# - Thor Erik @thorerik
16+
# - Winfried van Loon @winfried-van-loon
17+
# - TJ Miller @sixlive
18+
# - Yu-Lung Shao (Allen) @bestlong
19+
# - Milan Urukalo @urukalo
20+
# - Vince Chu @vwchu
21+
# - Huadong Zuo @zuohuadong
22+
# ================================================================================================
23+
24+
MAINTAINER "Laradock Team <[email protected]>"
25+
26+
ENV PHP_VERSION=5.6.35 \
27+
ALPINE_VERSION=3.4 \
28+
XDEBUG_VERSION=2.6.0
29+
30+
COPY ./docker-php-pecl-install /usr/local/bin/
31+
RUN apk add --no-cache $PHPIZE_DEPS \
32+
libmcrypt-dev \
33+
libltdl \
34+
zlib \
35+
icu-dev \
36+
g++ \
37+
gettext \
38+
curl-dev \
39+
openssl-dev \
40+
libcurl \
41+
&& pecl install xdebug-${XDEBUG_VERSION}
42+
43+
44+
COPY docker-php-source /usr/local/bin/
45+
COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/
46+
RUN docker-php-ext-enable sodium
47+
48+
RUN mkdir -p /var/log/php-fpm \
49+
&& mkdir -p /var/www/html \
50+
&& touch /var/log/php-fpm/fpm-error.log \
51+
&& chmod 777 /var/log/php-fpm/fpm-error.log
52+
53+
ENTRYPOINT ["docker-php-entrypoint"]
54+
WORKDIR /var/www/html
55+
56+
EXPOSE 9200 9000 9090 80
57+
CMD ["php-fpm"]
58+
59+
VOLUME ["/var/www/html"]

Dockerfile.build

+206
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
#
2+
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
3+
#
4+
# PLEASE DO NOT EDIT IT DIRECTLY.
5+
#
6+
7+
FROM alpine:3.4
8+
9+
# dependencies required for running "phpize"
10+
# these get automatically installed and removed by "docker-php-ext-*" (unless they're already installed)
11+
ENV PHPIZE_DEPS \
12+
autoconf \
13+
dpkg-dev dpkg \
14+
file \
15+
g++ \
16+
gcc \
17+
libc-dev \
18+
make \
19+
pkgconf \
20+
re2c
21+
22+
# persistent / runtime deps
23+
RUN apk add --no-cache --virtual .persistent-deps \
24+
ca-certificates \
25+
curl \
26+
tar \
27+
xz \
28+
# https://github.com/docker-library/php/issues/494
29+
openssl
30+
31+
# ensure www-data user exists
32+
RUN set -x \
33+
&& addgroup -g 82 -S www-data \
34+
&& adduser -u 82 -D -S -G www-data www-data
35+
# 82 is the standard uid/gid for "www-data" in Alpine
36+
# http://git.alpinelinux.org/cgit/aports/tree/main/apache2/apache2.pre-install?h=v3.3.2
37+
# http://git.alpinelinux.org/cgit/aports/tree/main/lighttpd/lighttpd.pre-install?h=v3.3.2
38+
# http://git.alpinelinux.org/cgit/aports/tree/main/nginx-initscripts/nginx-initscripts.pre-install?h=v3.3.2
39+
40+
ENV PHP_INI_DIR /usr/local/etc/php
41+
RUN mkdir -p $PHP_INI_DIR/conf.d
42+
43+
##<autogenerated>##
44+
ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data
45+
##</autogenerated>##
46+
47+
# Apply stack smash protection to functions using local buffers and alloca()
48+
# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64)
49+
# Enable optimization (-O2)
50+
# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default)
51+
# Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated)
52+
# https://github.com/docker-library/php/issues/272
53+
ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2"
54+
ENV PHP_CPPFLAGS="$PHP_CFLAGS"
55+
ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie"
56+
57+
ENV GPG_KEYS 0BD78B5F97500D450838F95DFE857D9A90D90EC1 6E4F6AB321FDC07F2C332E3AC2BF0BC433CFC8B3
58+
59+
ENV PHP_VERSION 5.6.36
60+
ENV PHP_URL="https://secure.php.net/get/php-5.6.36.tar.xz/from/this/mirror" PHP_ASC_URL="https://secure.php.net/get/php-5.6.36.tar.xz.asc/from/this/mirror"
61+
ENV PHP_SHA256="18f536bf548e909b4e980379d0c4e56d024b2b1eb1c9768fd169360491f1d6dd" PHP_MD5=""
62+
63+
RUN set -xe; \
64+
\
65+
apk add --no-cache --virtual .fetch-deps \
66+
gnupg \
67+
; \
68+
\
69+
mkdir -p /usr/src; \
70+
cd /usr/src; \
71+
\
72+
wget -O php.tar.xz "$PHP_URL"; \
73+
\
74+
if [ -n "$PHP_SHA256" ]; then \
75+
echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \
76+
fi; \
77+
if [ -n "$PHP_MD5" ]; then \
78+
echo "$PHP_MD5 *php.tar.xz" | md5sum -c -; \
79+
fi; \
80+
\
81+
if [ -n "$PHP_ASC_URL" ]; then \
82+
wget -O php.tar.xz.asc "$PHP_ASC_URL"; \
83+
export GNUPGHOME="$(mktemp -d)"; \
84+
for key in $GPG_KEYS; do \
85+
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \
86+
done; \
87+
gpg --batch --verify php.tar.xz.asc php.tar.xz; \
88+
rm -rf "$GNUPGHOME"; \
89+
fi; \
90+
\
91+
apk del .fetch-deps
92+
93+
COPY docker-php-source /usr/local/bin/
94+
95+
RUN set -xe \
96+
&& apk add --no-cache --virtual .build-deps \
97+
$PHPIZE_DEPS \
98+
coreutils \
99+
curl-dev \
100+
libedit-dev \
101+
openssl-dev \
102+
libxml2-dev \
103+
sqlite-dev \
104+
\
105+
&& export CFLAGS="$PHP_CFLAGS" \
106+
CPPFLAGS="$PHP_CPPFLAGS" \
107+
LDFLAGS="$PHP_LDFLAGS" \
108+
&& docker-php-source extract \
109+
&& cd /usr/src/php \
110+
&& gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
111+
&& ./configure \
112+
--build="$gnuArch" \
113+
--with-config-file-path="$PHP_INI_DIR" \
114+
--with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \
115+
\
116+
# make sure invalid --configure-flags are fatal errors intead of just warnings
117+
--enable-option-checking=fatal \
118+
\
119+
--disable-cgi \
120+
\
121+
# https://github.com/docker-library/php/issues/439
122+
--with-mhash \
123+
\
124+
# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236)
125+
--enable-ftp \
126+
# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195)
127+
--enable-mbstring \
128+
# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself)
129+
--enable-mysqlnd \
130+
\
131+
--with-curl \
132+
--with-libedit \
133+
--with-openssl \
134+
--with-zlib \
135+
\
136+
# bundled pcre does not support JIT on s390x
137+
# https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT
138+
$(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \
139+
\
140+
$PHP_EXTRA_CONFIGURE_ARGS \
141+
&& make -j "$(nproc)" \
142+
&& make install \
143+
&& { find /usr/local/bin /usr/local/sbin -type f -perm +0111 -exec strip --strip-all '{}' + || true; } \
144+
&& make clean \
145+
&& cd / \
146+
&& docker-php-source delete \
147+
\
148+
&& runDeps="$( \
149+
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \
150+
| tr ',' '\n' \
151+
| sort -u \
152+
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
153+
)" \
154+
&& apk add --no-cache --virtual .php-rundeps $runDeps \
155+
\
156+
&& apk del .build-deps \
157+
\
158+
# https://github.com/docker-library/php/issues/443
159+
&& pecl update-channels \
160+
&& rm -rf /tmp/pear ~/.pearrc
161+
162+
COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/
163+
164+
ENTRYPOINT ["docker-php-entrypoint"]
165+
##<autogenerated>##
166+
WORKDIR /var/www/html
167+
168+
RUN set -ex \
169+
&& cd /usr/local/etc \
170+
&& if [ -d php-fpm.d ]; then \
171+
# for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf"
172+
sed 's!=NONE/!=!g' php-fpm.conf.default | tee php-fpm.conf > /dev/null; \
173+
cp php-fpm.d/www.conf.default php-fpm.d/www.conf; \
174+
else \
175+
# PHP 5.x doesn't use "include=" by default, so we'll create our own simple config that mimics PHP 7+ for consistency
176+
mkdir php-fpm.d; \
177+
cp php-fpm.conf.default php-fpm.d/www.conf; \
178+
{ \
179+
echo '[global]'; \
180+
echo 'include=etc/php-fpm.d/*.conf'; \
181+
} | tee php-fpm.conf; \
182+
fi \
183+
&& { \
184+
echo '[global]'; \
185+
echo 'error_log = /proc/self/fd/2'; \
186+
echo; \
187+
echo '[www]'; \
188+
echo '; if we send this to /proc/self/fd/1, it never appears'; \
189+
echo 'access.log = /proc/self/fd/2'; \
190+
echo; \
191+
echo 'clear_env = no'; \
192+
echo; \
193+
echo '; Ensure worker stdout and stderr are sent to the main error log.'; \
194+
echo 'catch_workers_output = yes'; \
195+
} | tee php-fpm.d/docker.conf \
196+
&& { \
197+
echo '[global]'; \
198+
echo 'daemonize = no'; \
199+
echo; \
200+
echo '[www]'; \
201+
echo 'listen = 9000'; \
202+
} | tee php-fpm.d/zz-docker.conf
203+
204+
EXPOSE 9000
205+
CMD ["php-fpm"]
206+
##</autogenerated>##

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 Docker Framework
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile.am

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
IMAGE = dockerframework/phpfpm
2+
3+
clean-local:
4+
docker rmi $(CLEAN_OPTIONS) $(IMAGE):$(TAG) || true
5+
6+
build:
7+
docker build $(BUILD_OPTIONS) -t $(IMAGE):$(TAG) .
8+
9+
pull:
10+
docker pull $(PULL_OPTIONS) $(IMAGE):$(TAG)
11+
12+
push: build
13+
docker push $(PUSH_OPTIONS) $(IMAGE):$(TAG)

0 commit comments

Comments
 (0)