-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
42 lines (33 loc) · 1.52 KB
/
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
ARG PHP_VERSION=
FROM davidalger/php:${PHP_VERSION}-fpm as build
ARG COMPOSER_AUTH
ARG COMPOSER_PKGS
ARG MAGENTO_VERSION
ARG MAGENTO_EDITION
COPY composer-cache /root/.composer/cache
COPY php.d/*.ini /etc/php.d/
WORKDIR /var/www/html
RUN composer global require hirak/prestissimo \
&& composer create-project --no-interaction --repository=https://repo.magento.com/ \
magento/project-${MAGENTO_EDITION}-edition /var/www/html ${MAGENTO_VERSION}
RUN if [[ ${COMPOSER_PKGS} ]]; \
then composer require --no-interaction ${COMPOSER_PKGS}; \
fi
COPY config.php app/etc/config.php
RUN bin/magento module:enable --all \
&& bin/magento setup:di:compile \
&& bin/magento setup:static-content:deploy -f -j $(nproc)
## Requires mariadb and elasticsearch container on build network; see build.sh for details
RUN if [[ ${MAGENTO_VERSION} =~ ^2\.[4-9] ]]; then \
bin/magento setup:install --cleanup-database \
--db-host=mariadb --db-name=magento --db-user=magento --db-password=magento \
--search-engine=elasticsearch7 --elasticsearch-host=elasticsearch; \
else \
bin/magento setup:install --cleanup-database \
--db-host=mariadb --db-name=magento --db-user=magento --db-password=magento; \
fi
## Clean all the cruft out before copying files into final image
RUN find var app/etc/env.php -maxdepth 1 '!' -name var '!' -name .htaccess -exec rm -rf {} +
FROM davidalger/php:${PHP_VERSION}-fpm
COPY php.d/*.ini /etc/php.d/
COPY --from=build --chown=apache:apache /var/www/html /var/www/html