-
-
Notifications
You must be signed in to change notification settings - Fork 67
/
Dockerfile
53 lines (42 loc) · 2.12 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
ARG PHP_VERSION=8.0
ARG BASE_IMAGE=php:${PHP_VERSION}-cli
ARG TOOLBOX_EXCLUDED_TAGS="exclude-php:${PHP_VERSION}"
ARG TOOLBOX_VERSION="1.50.2"
FROM ${BASE_IMAGE} as phpbase
LABEL maintainer="Jakub Zalas <jakub@zalas.pl>"
ARG BUILD_DEPS="autoconf file g++ gcc libc-dev pkg-config re2c"
ARG LIB_DEPS="zlib1g-dev libzip-dev libbz2-dev libicu-dev"
ARG TOOL_DEPS="git graphviz make unzip gpg"
RUN apt-get update && apt-get install -y --no-install-recommends $TOOL_DEPS $BUILD_DEPS $LIB_DEPS && rm -rf /var/lib/apt/lists/* \
&& git clone https://github.com/nikic/php-ast.git && cd php-ast && phpize && ./configure && make && make install && cd .. && rm -rf php-ast && docker-php-ext-enable ast \
&& pecl install pcov && docker-php-ext-enable pcov \
&& docker-php-ext-configure intl \
&& docker-php-ext-install zip pcntl bz2 intl \
&& echo "date.timezone=Europe/London" >> $PHP_INI_DIR/php.ini \
&& echo "memory_limit=-1" >> $PHP_INI_DIR/php.ini \
&& echo "phar.readonly=0" >> $PHP_INI_DIR/php.ini \
&& echo "pcov.enabled=0" >> $PHP_INI_DIR/php.ini \
&& apt-get purge -y --auto-remove $BUILD_DEPS
FROM phpbase as toolbox
ARG TOOLBOX_VERSION
RUN curl -Ls https://github.com/jakzal/toolbox/releases/download/v$TOOLBOX_VERSION/toolbox.phar -o /toolbox \
&& chmod +x /toolbox
FROM phpbase as tools
# INSTALLATION_DATE is used to bust the docker layer cache
ARG INSTALLATION_DATE
ARG TOOLBOX_EXCLUDED_TAGS
ARG TOOLBOX_VERSION
ENV TOOLBOX_EXCLUDED_TAGS=${TOOLBOX_EXCLUDED_TAGS}
ENV TOOLBOX_TARGET_DIR="/tools"
ENV TOOLBOX_VERSION=${TOOLBOX_VERSION}
ENV COMPOSER_ALLOW_SUPERUSER 1
ENV COMPOSER_HOME=$TOOLBOX_TARGET_DIR/.composer
ENV PATH="$PATH:$TOOLBOX_TARGET_DIR:${COMPOSER_HOME}/vendor/bin:$TOOLBOX_TARGET_DIR/QualityAnalyzer/bin:$TOOLBOX_TARGET_DIR/DesignPatternDetector/bin:$TOOLBOX_TARGET_DIR/EasyCodingStandard/bin"
COPY --from=toolbox /toolbox $TOOLBOX_TARGET_DIR/toolbox
COPY --from=composer:2 /usr/bin/composer $TOOLBOX_TARGET_DIR/composer
COPY entrypoint.sh /entrypoint.sh
RUN php $TOOLBOX_TARGET_DIR/toolbox install \
&& rm -rf $COMPOSER_HOME/cache
WORKDIR $TOOLBOX_TARGET_DIR
ENTRYPOINT ["/entrypoint.sh"]
CMD php $TOOLBOX_TARGET_DIR/toolbox list-tools