This repository has been archived by the owner on Sep 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathDockerfile
64 lines (47 loc) · 2.05 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
# common stage
FROM php:8.0-cli-alpine AS common
RUN apk add bash git zlib-dev libzip-dev
RUN docker-php-ext-install zip
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer \
&& chmod +x /usr/bin/composer
WORKDIR /
COPY . /home
# test stage
FROM scratch AS test
COPY --from=common / /
CMD /home/ci/test.sh
# cli stage
FROM scratch AS cli
COPY --from=common / /
# Create suitable point where we expect dependency files to be mounted.
RUN mkdir /data
# Run script once to install deps once and for all.
RUN /home/entrypoint.sh
ENTRYPOINT ["/home/entrypoint.sh"]
# Default is same behaviour as if no arguments are given.
CMD []
# dev stage
FROM common AS dev
RUN apk add --no-cache $PHPIZE_DEPS && pecl install xdebug && docker-php-ext-enable xdebug
# blackfire
ENV BLACKFIRE_CONFIG /dev/null
ENV BLACKFIRE_LOG_LEVEL 4
RUN curl https://github.com/blackfireio/docker/raw/master/blackfire --output /usr/bin/blackfire -L \
&& chmod +x /usr/bin/blackfire
RUN curl https://github.com/blackfireio/docker/raw/master/blackfire-agent --output /usr/bin/blackfire-agent -L \
&& chmod +x /usr/bin/blackfire-agent
RUN mkdir -p /var/run/blackfire /var/log/blackfire
RUN chown 1001:1001 /var/run/blackfire /var/log/blackfire
ENV current_os=alpine
RUN version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \
&& curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/$current_os/amd64/$version \
&& mkdir -p /tmp/blackfire \
&& tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp/blackfire \
&& mv /tmp/blackfire/blackfire-*.so $(php -r "echo ini_get('extension_dir');")/blackfire.so \
&& printf "extension=blackfire.so\nblackfire.agent_socket=unix:///var/run/blackfire/agent.sock\n" > $PHP_INI_DIR/conf.d/blackfire.ini \
&& rm -rf /tmp/blackfire /tmp/blackfire-probe.tar.gz
RUN rm -Rf /home/vendor && /home/bin/console about --env=test
WORKDIR /home
#RUN composer install # no need to install since we'll mount host dir to /home during dev anyway.
USER 1001:1001
CMD bash