Repository navigation
Expand file tree
/
Copy pathDockerfile.test
More file actions
42 lines (32 loc) · 1.73 KB
/
Copy pathDockerfile.test
File metadata and controls
42 lines (32 loc) · 1.73 KB
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
# Test-only image — never pushed, never used in production. Reuses the same
# php:8.4-apache base as the main Dockerfile (already pulled locally in most
# cases) so layers are shared, but adds Composer/PHPUnit, which the shipped
# image intentionally does not carry.
FROM php:8.4-apache
# Same >= 8.4.27 floor as the main Dockerfile (CVE-2026-109618/109619).
RUN php -r 'exit(version_compare(PHP_VERSION, "8.4.27", ">=") ? 0 : 1);'
# snmp (not just libsnmp-dev) must stay installed: purging libsnmp-dev alone
# cascades to remove libsnmp40t64 too (nothing else would depend on it), which
# breaks the compiled snmp.so at runtime. Keep both packages listed.
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
sqlite3 libsqlite3-dev snmp libsnmp-dev git unzip curl \
&& docker-php-ext-install pdo_sqlite snmp \
&& apt-get purge -y --auto-remove libsqlite3-dev libsnmp-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# APCu, as in the shipped image: tests seed PNMSnmp's cache with SNMP walk
# results (no agent runs here). Enabled for the CLI, where PHPUnit runs.
RUN pecl install apcu \
&& docker-php-ext-enable apcu \
&& echo 'apc.enable_cli = 1' > /usr/local/etc/php/conf.d/apcu-cli.ini
RUN { \
echo 'error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE'; \
} > /usr/local/etc/php/conf.d/custom.ini
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
WORKDIR /app
COPY composer.json /app/composer.json
RUN composer install --no-interaction --prefer-dist
COPY . /app
RUN mkdir -p protected/runtime && cp protected/data/phpnetmap.db protected/runtime/test.db
CMD ["vendor/bin/phpunit", "-c", "protected/tests/phpunit.xml"]