-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
56 lines (41 loc) · 1.9 KB
/
Copy pathDockerfile
File metadata and controls
56 lines (41 loc) · 1.9 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
# syntax=docker/dockerfile:1
FROM php:8.5-fpm-alpine AS base
# Install system dependencies and PHP extensions
RUN apk --no-cache upgrade \
&& apk add --no-cache \
oniguruma-dev \
libzip-dev \
zip \
unzip \
&& docker-php-ext-install pdo pdo_mysql mbstring zip
WORKDIR /var/www/html
COPY docker/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["php-fpm"]
# ---------------------------------------------------------------------------
# dev: Xdebug + full (dev) Composer dependencies, unoptimised autoloader.
# Used by docker-compose for local development; the source tree is bind
# mounted over this at runtime, so the COPY/composer install below just
# make `docker build --target dev .` usable on its own too. Composer itself
# is kept in the image (not just mounted for this RUN step) so it's still
# available at runtime for `composer require`/`composer update`.
# ---------------------------------------------------------------------------
FROM base AS dev
RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS linux-headers \
&& pecl install xdebug \
&& docker-php-ext-enable xdebug \
&& apk del .build-deps
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
COPY docker/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
COPY . .
RUN composer install --no-interaction --prefer-dist
RUN chown -R www-data:www-data storage bootstrap/cache
# ---------------------------------------------------------------------------
# production (default target): no dev dependencies, optimized autoloader.
# ---------------------------------------------------------------------------
FROM base AS production
COPY . .
RUN --mount=type=bind,from=composer:2,source=/usr/bin/composer,target=/usr/bin/composer \
composer install --no-dev --optimize-autoloader --no-interaction --prefer-dist
RUN chown -R www-data:www-data storage bootstrap/cache