Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ext-meminfo to -dev images #11

Merged
merged 1 commit into from
Sep 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion Dockerfile-nts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,20 @@ RUN git fetch \
cp "$EXTENSION_DIR/uv.so" /uv.so
RUN sha256sum /uv.so

FROM php:7.3-cli-alpine3.10 AS nts
FROM php:7.3-cli-alpine AS build-meminfo
RUN apk update && \
apk add --no-cache $PHPIZE_DEPS git libuv-dev && \
git clone https://github.com/BitOne/php-meminfo.git
WORKDIR /php-meminfo/extension/php7
RUN phpize
RUN ./configure --enable-meminfo
RUN make install
RUN EXTENSION_DIR=`php-config --extension-dir 2>/dev/null` && \
cp "$EXTENSION_DIR/meminfo.so" /meminfo.so
RUN sha256sum /meminfo.so

FROM php:7.3-alpine AS nts

RUN set -x \
&& addgroup -g 1000 app \
&& adduser -u 1000 -D -G app app
Expand Down Expand Up @@ -75,6 +88,14 @@ RUN apk add \
bash \
strace

# Install docker help scripts
COPY src/php/utils/docker/ /usr/local/bin/

COPY --from=build-meminfo /meminfo.so /meminfo.so
RUN EXTENSION_DIR=`php-config --extension-dir 2>/dev/null` && \
mv /*.so "$EXTENSION_DIR/" && \
docker-php-ext-enable meminfo

# Install Xdebug and development specific configuration
RUN docker-php-dev-mode xdebug \
&& docker-php-dev-mode config
Expand Down
20 changes: 19 additions & 1 deletion Dockerfile-zts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,20 @@ RUN git fetch \
cp "$EXTENSION_DIR/uv.so" /uv.so
RUN sha256sum /uv.so

FROM php:7.3-zts-alpine3.10 AS zts
FROM php:7.3-zts-alpine AS build-meminfo
RUN apk update && \
apk add --no-cache $PHPIZE_DEPS git libuv-dev && \
git clone https://github.com/BitOne/php-meminfo.git
WORKDIR /php-meminfo/extension/php7
RUN phpize
RUN ./configure --enable-meminfo
RUN make install
RUN EXTENSION_DIR=`php-config --extension-dir 2>/dev/null` && \
cp "$EXTENSION_DIR/meminfo.so" /meminfo.so
RUN sha256sum /meminfo.so

FROM php:7.3-zts-alpine AS zts

RUN set -x \
&& addgroup -g 1000 app \
&& adduser -u 1000 -D -G app app
Expand Down Expand Up @@ -99,6 +112,11 @@ RUN apk add \
# Install docker help scripts
COPY src/php/utils/docker/ /usr/local/bin/

COPY --from=build-meminfo /meminfo.so /meminfo.so
RUN EXTENSION_DIR=`php-config --extension-dir 2>/dev/null` && \
mv /*.so "$EXTENSION_DIR/" && \
docker-php-ext-enable meminfo

# Install Xdebug and development specific configuration
RUN docker-php-dev-mode xdebug \
&& docker-php-dev-mode config
Expand Down
1 change: 1 addition & 0 deletions src/php/conf/default.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
date.timezone=UTC
memory_limit=-1
expose_php=off
2 changes: 1 addition & 1 deletion test-nts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ declare TEST_SUITE
if [[ $DOCKER_TAG == *"-dev" ]]; then
TEST_SUITE="php_nts or php_dev"
else
TEST_SUITE="php_nts and not php_dev"
TEST_SUITE="php_nts or php_no_dev and not php_dev"
fi

printf "Starting a container for '%s'\\n" "$DOCKER_TAG"
Expand Down
2 changes: 1 addition & 1 deletion test-zts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ declare TEST_SUITE
if [[ $DOCKER_TAG == *"-dev" ]]; then
TEST_SUITE="php_zts or php_dev"
else
TEST_SUITE="php_zts and not php_dev"
TEST_SUITE="php_zts or php_no_dev and not php_dev"
fi

printf "Starting a container for '%s'\\n" "$DOCKER_TAG"
Expand Down
10 changes: 10 additions & 0 deletions test/container/test_php_dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,13 @@ def test_configuration_is_not_effective(host):
@pytest.mark.php_no_dev
def test_xdebug_is_not_loaded(host):
assert 'Xdebug' not in host.run('php -m').stdout

@pytest.mark.php_dev
def test_php_meminfo_is_enabled(host):
output = host.run('php -r "exit(function_exists(\'meminfo_dump\') ? 0 : 255);"')
assert output.rc == 0

@pytest.mark.php_no_dev
def test_php_meminfo_is_not_enabled(host):
output = host.run('php -r "exit(function_exists(\'meminfo_dump\') ? 0 : 255);"')
assert output.rc == 255