Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
59 lines (48 loc) · 1.95 KB
/
Copy pathDockerfile
File metadata and controls
59 lines (48 loc) · 1.95 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
57
58
59
# syntax=docker/dockerfile:1
##
## Production image for the framework.
## Build: docker build -t framework:latest .
## Run: docker run -p 8080:80 framework:latest
##
## For local development, use docker-compose.yml instead — it bind-mounts
## the working tree and skips the --no-dev / optimize steps below.
##
FROM composer:2 AS vendor
WORKDIR /app
COPY composer.json composer.lock* ./
RUN composer install \
--no-dev \
--no-scripts \
--no-interaction \
--optimize-autoloader \
--classmap-authoritative \
--ignore-platform-reqs
FROM php:8.1-apache AS production
RUN apt-get update && apt-get install -y --no-install-recommends \
libpng-dev libjpeg-dev libfreetype6-dev libicu-dev libmagickwand-dev unzip curl \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j"$(nproc)" mysqli pdo pdo_mysql intl exif gd \
&& pecl install imagick && docker-php-ext-enable imagick \
&& a2enmod rewrite \
&& sed -ri -e 's!AllowOverride None!AllowOverride All!g' /etc/apache2/apache2.conf \
&& apt-get purge -y --auto-remove unzip \
&& rm -rf /var/lib/apt/lists/*
# Recommended OPcache settings for production — see docs/performance.md
RUN { \
echo 'opcache.enable=1'; \
echo 'opcache.memory_consumption=256'; \
echo 'opcache.interned_strings_buffer=16'; \
echo 'opcache.max_accelerated_files=10000'; \
echo 'opcache.validate_timestamps=0'; \
echo 'opcache.save_comments=1'; \
echo 'opcache.fast_shutdown=1'; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini
WORKDIR /var/www/html
COPY . .
COPY --from=vendor /app/resources/vendor ./resources/vendor
RUN chown -R www-data:www-data /var/www/html \
&& find /var/www/html -type d -exec chmod 755 {} \; \
&& find /var/www/html -type f -exec chmod 644 {} \;
EXPOSE 80
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s \
CMD curl -f http://localhost/health || exit 1