-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
58 lines (47 loc) · 2.21 KB
/
Copy pathDockerfile
File metadata and controls
58 lines (47 loc) · 2.21 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# https://hub.docker.com/_/php
# https://github.com/docker-library/docs/blob/master/php/README.md#supported-tags-and-respective-dockerfile-links
FROM php:8.4.23-cli-alpine
# Install git, entr, and libtool to install PIE and xdebug, then remove them to keep the image small
# Install entr for file watching
# Install PIE, then use it to install xdebug
# https://github.com/php/pie
RUN apk add --no-cache \
git \
entr \
libtool \
build-base \
autoconf \
pkgconfig \
linux-headers \
&& curl -fL -o /usr/local/bin/pie https://github.com/php/pie/releases/latest/download/pie.phar \
&& chmod +x /usr/local/bin/pie \
&& pie install xdebug/xdebug \
&& docker-php-ext-enable xdebug \
&& echo 'xdebug.mode=coverage' > /usr/local/etc/php/conf.d/xdebug.ini \
&& apk del build-base autoconf pkgconfig libtool git linux-headers \
&& rm -rf /usr/local/bin/pie \
&& rm -rf /tmp/*
# Enable inotify workaround for entr for macOS and WSL1
# https://github.com/eradman/entr#docker-and-wsl
ENV ENTR_INOTIFY_WORKAROUND=1
# Remove 10 MB /usr/src/php.tar.xz file. Unnecessary since we never update PHP without rebuilding.
# Ref: https://github.com/docker-library/php/issues/488
RUN rm /usr/src/php.tar.xz /usr/src/php.tar.xz.asc
# Get the latest release of phpunit from https://phar.phpunit.de/
# Bump this automatically with `npm run bump`
RUN curl -L https://phar.phpunit.de/phpunit-13.2.2.phar -o /usr/local/bin/phpunit \
&& chmod +x /usr/local/bin/phpunit
# Download and require Kint phar (update src/debug_loader.php)
RUN curl -L https://raw.githubusercontent.com/kint-php/kint/master/build/kint.phar -o /usr/local/lib/kint.phar \
&& chmod +x /usr/local/lib/kint.phar
# Skeleton debug_loader
# Load Kint and anything else from this file since auto_prepend_file only accepts a single file
COPY src/debug_loader.php /usr/local/lib
# Load debug libraries
RUN echo 'auto_prepend_file=/usr/local/lib/debug_loader.php' > /usr/local/etc/php/conf.d/debug.ini;
RUN echo '#!/bin/sh' > /usr/local/bin/watch \
&& echo "find lib src test tests -name '*.php' | entr -c phpunit" >> /usr/local/bin/watch \
&& chmod +x /usr/local/bin/watch
USER 1000:1000
WORKDIR /app
CMD ["phpunit"]