-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathdev.Dockerfile
72 lines (65 loc) · 2.05 KB
/
dev.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
# syntax=docker/dockerfile:1.2
ARG PHP_VERSION
FROM php:$PHP_VERSION-cli-alpine AS base
ENV COMPOSER_ALLOW_SUPERUSER=1
ENV PHP_CS_FIXER_IGNORE_ENV=True
RUN apk add --no-cache \
build-base \
curl \
freetype-dev \
git \
jpeg-dev \
libjpeg-turbo-dev \
libpng-dev \
libwebp-dev \
libxpm-dev \
mariadb \
mariadb-client \
musl-dev \
python3-dev \
zlib-dev \
linux-headers
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer \
&& composer --version
RUN docker-php-ext-configure gd --with-freetype --with-jpeg
RUN if [ "$PHP_VERSION" = "7.4.33" ] ; then pecl install xdebug-3.1.6 && docker-php-ext-enable xdebug ; else pecl install xdebug && docker-php-ext-enable xdebug ; fi
RUN docker-php-ext-install gd pdo_mysql
RUN echo 'memory_limit = -1' >> $PHP_INI_DIR/conf.d/php.ini
WORKDIR /src
FROM base AS vendored
ENV COMPOSER_ALLOW_SUPERUSER=1
ENV PHP_CS_FIXER_IGNORE_ENV=True
RUN --mount=type=bind,target=.,rw \
--mount=type=cache,target=/src/vendor \
composer validate \
&& composer install --no-interaction --no-ansi \
&& mkdir /out \
&& cp composer.lock /out
FROM scratch AS vendor-update
ENV COMPOSER_ALLOW_SUPERUSER=1
ENV PHP_CS_FIXER_IGNORE_ENV=True
COPY --from=vendored /out /
FROM vendored AS vendor-validate
ENV COMPOSER_ALLOW_SUPERUSER=1
ENV PHP_CS_FIXER_IGNORE_ENV=True
RUN --mount=type=bind,target=.,rw \
git add -A && cp -Rf /out/* .; \
if [ -n "$(git status --porcelain -- composer.lock)" ]; then \
echo >&2 'ERROR: Vendor result differs. Please vendor your package with "docker buildx bake vendor-update"'; \
git status --porcelain -- composer.lock; \
exit 1; \
fi
FROM vendored AS lint
ENV COMPOSER_ALLOW_SUPERUSER=1
ENV PHP_CS_FIXER_IGNORE_ENV=True
RUN --mount=type=bind,target=.,rw \
--mount=type=cache,target=/src/vendor \
composer lint-validate
FROM vendored AS test
ENV COMPOSER_ALLOW_SUPERUSER=1
ENV PHP_CS_FIXER_IGNORE_ENV=True
COPY . .
RUN composer install --no-interaction --no-ansi \
&& mkdir tests/storage_test \
&& mkdir tests/medias
ENTRYPOINT ["composer"]