-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdockerfile
More file actions
36 lines (28 loc) · 955 Bytes
/
dockerfile
File metadata and controls
36 lines (28 loc) · 955 Bytes
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
FROM php:8.4-fpm
#Install system dependencies
RUN apt-get update && apt-get install -y \
git \
unzip \
libzip-dev \
libpng-dev \
libjpeg-dev \
libfreetype6-dev \
libyaml-dev \
&& rm -rf /var/lib/apt/lists/*
#Install PHP extensions
RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) gd zip pdo pdo_mysql \
&& pecl install yaml \
&& docker-php-ext-enable yaml
#Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
#Set working directory
WORKDIR /var/www/html
# Configure git to treat this directory as safe
RUN git config --global --add safe.directory /var/www/html
# Copy only composer files to leverage Docker cache (.lock cannot be added because it may not exist yet)
COPY composer.json ./
# Install PHP dependencies
RUN composer install --no-interaction --optimize-autoloader
# Copy the rest of the application code
COPY . .