-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathDockerfile
92 lines (68 loc) · 2.08 KB
/
Dockerfile
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
ARG PHP_VERSION=5.6
ARG PHPSTAN_PHP_VERSION=7.2
ARG NGINX_VERSION=1.21
FROM php:${PHP_VERSION}-fpm-alpine AS php
RUN set -eux; \
apk add --no-cache \
chromium \
acl \
libzip-dev \
$PHPIZE_DEPS \
wget \
; \
docker-php-ext-install -j$(nproc) \
json \
zip \
;
RUN wget https://xdebug.org/files/xdebug-2.5.5.tgz && \
tar -xzf xdebug-2.5.5.tgz && \
cd xdebug-2.5.5 && \
phpize && \
./configure --enable-xdebug && \
make && \
make install && \
cd .. && \
rm xdebug-2.5.5.tgz && \
rm -rf xdebug-2.5.5
COPY --from=composer:2.2 /usr/bin/composer /usr/bin/composer
# https://getcomposer.org/doc/03-cli.md#composer-allow-superuser
ENV COMPOSER_ALLOW_SUPERUSER=1
RUN set -eux; \
composer clear-cache
ENV PATH="${PATH}:/root/.composer/vendor/bin"
WORKDIR /srv/paygreen
COPY composer.json composer.lock phpunit.xml.dist ./
COPY lib lib/
COPY tests tests/
COPY features features/
RUN set -eux; \
composer install --prefer-dist --no-scripts --no-progress; \
composer clear-cache
COPY docker/php/docker-entrypoint.sh /usr/local/bin/docker-entrypoint
RUN chmod +x /usr/local/bin/docker-entrypoint
ENTRYPOINT ["docker-entrypoint"]
CMD ["php-fpm"]
FROM php:${PHPSTAN_PHP_VERSION}-fpm-alpine AS phptools
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
# https://getcomposer.org/doc/03-cli.md#composer-allow-superuser
ENV COMPOSER_ALLOW_SUPERUSER=1
RUN set -eux; \
composer clear-cache
ENV PATH="${PATH}:/root/.composer/vendor/bin"
WORKDIR /srv/paygreen
COPY composer.json composer.lock phpunit.xml.dist ./
COPY lib lib/
COPY tests tests/
COPY --from=php /srv/paygreen/vendor vendor/
RUN set -eux; \
composer global require phpstan/phpstan; \
composer global require friendsofphp/php-cs-fixer; \
export PATH=~/.composer/vendor/bin:$PATH
COPY docker/phpstan/docker-entrypoint.sh /usr/local/bin/docker-entrypoint
RUN chmod +x /usr/local/bin/docker-entrypoint
ENTRYPOINT ["docker-entrypoint"]
CMD ["php-fpm"]
FROM nginx:${NGINX_VERSION}-alpine AS nginx
COPY docker/nginx/conf.d/default.conf /etc/nginx/conf.d/
WORKDIR /srv/paygreen
COPY --from=php /srv/paygreen ./