Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit aede413

Browse files
committed
add debug image
1 parent 56785ad commit aede413

File tree

7 files changed

+651
-0
lines changed

7 files changed

+651
-0
lines changed

‎docker-compose.debug.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
version: '3.7'
2+
services:
3+
php:
4+
build:
5+
context: ./docker/php
6+
dockerfile: Dockerfile.debug
7+
args:
8+
PHP_VERSION: 7.4.14
9+
LIBRDKAFKA_VERSION: v1.5.3
10+
PHP_RDKAFKA_VERSION: 5.x
11+
tty: true
12+
working_dir: /app
13+
volumes:
14+
- ./:/app
15+
16+
zookeeper:
17+
image: confluentinc/cp-zookeeper:5.5.0
18+
environment:
19+
ZOOKEEPER_CLIENT_PORT: 2182
20+
ZOOKEEPER_TICK_TIME: 2000
21+
22+
kafka:
23+
image: confluentinc/cp-kafka:5.5.0
24+
depends_on:
25+
- zookeeper
26+
ports:
27+
- 9096:9096
28+
environment:
29+
KAFKA_BROKER_ID: 1
30+
KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2182'
31+
KAFKA_ADVERTISED_LISTENERS: 'PLAINTEXT://kafka:9096'
32+
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
33+
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
34+
KAFKA_NUM_PARTITIONS: 1
35+
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
36+
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
37+
38+
kafka-schema-registry:
39+
image: confluentinc/cp-schema-registry:5.5.0
40+
depends_on:
41+
- zookeeper
42+
- kafka
43+
ports:
44+
- "9083:9083"
45+
environment:
46+
SCHEMA_REGISTRY_HOST_NAME: kafka-schema-registry
47+
SCHEMA_REGISTRY_LISTENERS: "http://0.0.0.0:9083"
48+
SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL: 'zookeeper:2182'
49+
SCHEMA_REGISTRY_AVRO_COMPATIBILITY_LEVEL: 'full_transitive'

‎docker/php/Dockerfile.debug

Lines changed: 245 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,245 @@
1+
FROM debian:buster-slim
2+
3+
ARG PHP_VERSION
4+
ARG LIBRDKAFKA_VERSION
5+
ARG PHP_RDKAFKA_VERSION
6+
7+
# prevent Debian's PHP packages from being installed
8+
# https://github.com/docker-library/php/pull/542
9+
RUN set -eux; \
10+
{ \
11+
echo 'Package: php*'; \
12+
echo 'Pin: release *'; \
13+
echo 'Pin-Priority: -1'; \
14+
} > /etc/apt/preferences.d/no-debian-php
15+
16+
# dependencies required for running "phpize"
17+
# (see persistent deps below)
18+
ENV PHPIZE_DEPS \
19+
autoconf \
20+
dpkg-dev \
21+
file \
22+
g++ \
23+
gcc \
24+
libc-dev \
25+
make \
26+
pkg-config \
27+
re2c
28+
29+
# persistent / runtime deps
30+
RUN set -eux; \
31+
apt-get update; \
32+
apt-get install -y --no-install-recommends \
33+
$PHPIZE_DEPS \
34+
ca-certificates \
35+
curl \
36+
xz-utils \
37+
; \
38+
rm -rf /var/lib/apt/lists/*
39+
40+
ENV PHP_INI_DIR /usr/local/etc/php
41+
RUN set -eux; \
42+
mkdir -p "$PHP_INI_DIR/conf.d"; \
43+
# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743)
44+
[ ! -d /var/www/html ]; \
45+
mkdir -p /var/www/html; \
46+
chown www-data:www-data /var/www/html; \
47+
chmod 777 /var/www/html
48+
49+
# https://github.com/docker-library/php/pull/939#issuecomment-730501748
50+
ENV PHP_EXTRA_CONFIGURE_ARGS --enable-embed
51+
52+
# Apply stack smash protection to functions using local buffers and alloca()
53+
# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64)
54+
# Enable optimization (-O2)
55+
# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default)
56+
# https://github.com/docker-library/php/issues/272
57+
# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php)
58+
ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
59+
ENV PHP_CPPFLAGS="$PHP_CFLAGS"
60+
ENV PHP_LDFLAGS="-Wl,-O1 -pie"
61+
62+
ENV GPG_KEYS 42670A7FE4D0441C8E4632349E4FDC074A4EF02D 5A52880781F755608BF815FC910DEB46F53EA312
63+
64+
ENV PHP_VERSION ${PHP_VERSION}
65+
ENV PHP_URL="https://www.php.net/distributions/php-7.4.14.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-7.4.14.tar.xz.asc"
66+
ENV PHP_SHA256="f9f3c37969fcd9006c1dbb1dd76ab53f28c698a1646fa2dde8547c3f45e02886"
67+
68+
RUN set -eux; \
69+
\
70+
savedAptMark="$(apt-mark showmanual)"; \
71+
apt-get update; \
72+
apt-get install -y --no-install-recommends gnupg dirmngr; \
73+
rm -rf /var/lib/apt/lists/*; \
74+
\
75+
mkdir -p /usr/src; \
76+
cd /usr/src; \
77+
\
78+
curl -fsSL -o php.tar.xz "$PHP_URL"; \
79+
\
80+
if [ -n "$PHP_SHA256" ]; then \
81+
echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \
82+
fi; \
83+
\
84+
if [ -n "$PHP_ASC_URL" ]; then \
85+
curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \
86+
export GNUPGHOME="$(mktemp -d)"; \
87+
for key in $GPG_KEYS; do \
88+
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \
89+
done; \
90+
gpg --batch --verify php.tar.xz.asc php.tar.xz; \
91+
gpgconf --kill all; \
92+
rm -rf "$GNUPGHOME"; \
93+
fi; \
94+
\
95+
apt-mark auto '.*' > /dev/null; \
96+
apt-mark manual $savedAptMark > /dev/null; \
97+
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false
98+
99+
COPY docker-php-source /usr/local/bin/
100+
101+
RUN set -eux; \
102+
\
103+
savedAptMark="$(apt-mark showmanual)"; \
104+
apt-get update; \
105+
apt-get install -y --no-install-recommends \
106+
libargon2-dev \
107+
libcurl4-openssl-dev \
108+
libedit-dev \
109+
libonig-dev \
110+
libsodium-dev \
111+
libsqlite3-dev \
112+
libssl-dev \
113+
libxml2-dev \
114+
zlib1g-dev \
115+
${PHP_EXTRA_BUILD_DEPS:-} \
116+
; \
117+
rm -rf /var/lib/apt/lists/*; \
118+
\
119+
export \
120+
CFLAGS="$PHP_CFLAGS" \
121+
CPPFLAGS="$PHP_CPPFLAGS" \
122+
LDFLAGS="$PHP_LDFLAGS" \
123+
; \
124+
docker-php-source extract; \
125+
cd /usr/src/php; \
126+
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
127+
debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
128+
# https://bugs.php.net/bug.php?id=74125
129+
if [ ! -d /usr/include/curl ]; then \
130+
ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \
131+
fi; \
132+
./configure \
133+
--build="$gnuArch" \
134+
--with-config-file-path="$PHP_INI_DIR" \
135+
--with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \
136+
\
137+
# make sure invalid --configure-flags are fatal errors instead of just warnings
138+
--enable-option-checking=fatal \
139+
\
140+
# https://github.com/docker-library/php/issues/439
141+
--with-mhash \
142+
\
143+
# https://github.com/docker-library/php/issues/822
144+
--with-pic \
145+
\
146+
# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236)
147+
--enable-ftp \
148+
# --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)
149+
--enable-mbstring \
150+
# --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)
151+
--enable-mysqlnd \
152+
# https://wiki.php.net/rfc/argon2_password_hash (7.2+)
153+
--with-password-argon2 \
154+
# https://wiki.php.net/rfc/libsodium
155+
--with-sodium=shared \
156+
# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109)
157+
--with-pdo-sqlite=/usr \
158+
--with-sqlite3=/usr \
159+
\
160+
--with-curl \
161+
--with-libedit \
162+
--with-openssl \
163+
--with-zlib \
164+
\
165+
# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear")
166+
--with-pear \
167+
\
168+
# bundled pcre does not support JIT on s390x
169+
# https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT
170+
$(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \
171+
--with-libdir="lib/$debMultiarch" \
172+
\
173+
${PHP_EXTRA_CONFIGURE_ARGS:-} \
174+
; \
175+
make -j "$(nproc)"; \
176+
find -type f -name '*.a' -delete; \
177+
make install; \
178+
find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \
179+
make clean; \
180+
\
181+
# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable)
182+
cp -v php.ini-* "$PHP_INI_DIR/"; \
183+
\
184+
cd /; \
185+
docker-php-source delete; \
186+
\
187+
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
188+
apt-mark auto '.*' > /dev/null; \
189+
[ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \
190+
find /usr/local -type f -executable -exec ldd '{}' ';' \
191+
| awk '/=>/ { print $(NF-1) }' \
192+
| sort -u \
193+
| xargs -r dpkg-query --search \
194+
| cut -d: -f1 \
195+
| sort -u \
196+
| xargs -r apt-mark manual \
197+
; \
198+
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
199+
\
200+
# update pecl channel definitions https://github.com/docker-library/php/issues/443
201+
pecl update-channels; \
202+
rm -rf /tmp/pear ~/.pearrc; \
203+
\
204+
# smoke test
205+
php --version
206+
207+
COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/
208+
209+
# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598)
210+
RUN docker-php-ext-enable sodium
211+
212+
ENTRYPOINT ["docker-php-entrypoint"]
213+
CMD ["php", "-a"]
214+
215+
216+
# Customization
217+
# Install packages
218+
RUN apt-get update\
219+
&& apt-get install -y bash sudo git gcc g++ make autoconf \
220+
icu-devtools libssl-dev libsasl2-dev libpcre3-dev libzstd-dev liblz4-dev zlib1g-dev libicu63 wget gettext valgrind vim \
221+
&& rm -rf /var/lib/apt/lists/*
222+
223+
# Install librdkafka and ext-rdkafka
224+
RUN git clone --depth 1 --branch ${LIBRDKAFKA_VERSION} https://github.com/edenhill/librdkafka.git \
225+
&& cd librdkafka \
226+
&& ./configure \
227+
&& make \
228+
&& make install \
229+
&& git clone --depth 1 --branch ${PHP_RDKAFKA_VERSION} https://github.com/arnaud-lb/php-rdkafka.git \
230+
&& cd php-rdkafka \
231+
&& phpize \
232+
&& ./configure \
233+
&& make all -j 5 \
234+
&& make install \
235+
&& cd ../..;rm -rf librdkafka
236+
237+
# Install php extensions
238+
RUN docker-php-ext-install pcntl && \
239+
docker-php-ext-enable rdkafka pcntl > /dev/null 2>&1
240+
241+
# Install composer
242+
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer
243+
244+
ENTRYPOINT ["docker-php-entrypoint"]
245+
CMD ["php", "-a"]

‎docker/php/docker-php-entrypoint

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
set -e
3+
4+
# first arg is `-f` or `--some-option`
5+
if [ "${1#-}" != "1ドル" ]; then
6+
set -- php "$@"
7+
fi
8+
9+
exec "$@"

‎docker/php/docker-php-ext-configure

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/bin/sh
2+
set -e
3+
4+
# prefer user supplied CFLAGS, but default to our PHP_CFLAGS
5+
: ${CFLAGS:=$PHP_CFLAGS}
6+
: ${CPPFLAGS:=$PHP_CPPFLAGS}
7+
: ${LDFLAGS:=$PHP_LDFLAGS}
8+
export CFLAGS CPPFLAGS LDFLAGS
9+
10+
srcExists=
11+
if [ -d /usr/src/php ]; then
12+
srcExists=1
13+
fi
14+
docker-php-source extract
15+
if [ -z "$srcExists" ]; then
16+
touch /usr/src/php/.docker-delete-me
17+
fi
18+
19+
cd /usr/src/php/ext
20+
21+
usage() {
22+
echo "usage: 0ドル ext-name [configure flags]"
23+
echo " ie: 0ドル gd --with-jpeg-dir=/usr/local/something"
24+
echo
25+
echo 'Possible values for ext-name:'
26+
find . \
27+
-mindepth 2 \
28+
-maxdepth 2 \
29+
-type f \
30+
-name 'config.m4' \
31+
| xargs -n1 dirname \
32+
| xargs -n1 basename \
33+
| sort \
34+
| xargs
35+
echo
36+
echo 'Some of the above modules are already compiled into PHP; please check'
37+
echo 'the output of "php -i" to see which modules are already loaded.'
38+
}
39+
40+
ext="1ドル"
41+
if [ -z "$ext" ] || [ ! -d "$ext" ]; then
42+
usage >&2
43+
exit 1
44+
fi
45+
shift
46+
47+
pm='unknown'
48+
if [ -e /lib/apk/db/installed ]; then
49+
pm='apk'
50+
fi
51+
52+
if [ "$pm" = 'apk' ]; then
53+
if \
54+
[ -n "$PHPIZE_DEPS" ] \
55+
&& ! apk info --installed .phpize-deps > /dev/null \
56+
&& ! apk info --installed .phpize-deps-configure > /dev/null \
57+
; then
58+
apk add --no-cache --virtual .phpize-deps-configure $PHPIZE_DEPS
59+
fi
60+
fi
61+
62+
if command -v dpkg-architecture > /dev/null; then
63+
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"
64+
set -- --build="$gnuArch" "$@"
65+
fi
66+
67+
cd "$ext"
68+
phpize
69+
./configure --enable-option-checking=fatal "$@"

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /