-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathphp.Dockerfile
31 lines (21 loc) · 901 Bytes
/
php.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
# Stage 1: Composer Container
FROM composer:2 AS composer_stage
# Set the working directory inside the Composer container
WORKDIR /app
# Copy the composer.json and composer.lock to the container
COPY ./composer.json composer.json
COPY ./composer.lock composer.lock
# Install Composer dependencies
RUN composer install --ignore-platform-reqs --prefer-dist --no-scripts --no-progress --no-interaction --no-dev --no-autoloader
# Stage 2: PHP 8.2 Apache Container
FROM php:8.2-apache
RUN a2enmod rewrite
# Copy the vendor folder from the Composer container to /var/www/html
COPY --from=composer_stage /app/vendor /var/www/html/vendor
COPY --from=composer_stage /usr/bin/composer /usr/local/bin/composer
COPY ./src /var/www/html/src
COPY ./test /var/www/html/test
COPY .htaccess /var/www/html
COPY composer.json /var/www/html
COPY composer.lock /var/www/html
RUN composer dump-autoload --optimize