-
Notifications
You must be signed in to change notification settings - Fork 2
/
Install_Dockerfile.twig
84 lines (63 loc) · 2.94 KB
/
Install_Dockerfile.twig
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
{% set shopwareVersion = imageName|split('_')[1] %}
{% set mysqlVersion = imageName|split('_')[2] %}
{% set phpVersion = imageName|split('_')[3] %}
{% set consentManagerVersion = imageName|split('_')[4] %}
{% set consentManagerRequired = consentManagerVersion != 'none' %}
# Check out shopware source
FROM alpine/git:latest AS clone
RUN git clone https://github.com/shopware5/shopware.git /shopware --depth=1 --branch={{ shopwareVersion }}
RUN cd /shopware && \
git status && \
rm -rf .git
{% if consentManagerRequired %}
RUN cd /shopware/custom/plugins && \
git clone https://github.com/shopware5/SwagCookieConsentManager.git SwagCookieConsentManager --depth=1 --branch={{ consentManagerVersion }}
{% endif %}
# Inherit files, install NodeJS-dependencies
FROM node:10 AS js-deps
COPY --from="clone" /shopware /shopware
WORKDIR /shopware
RUN npm install --prefix ./themes && \
npm install --prefix ./themes/Frontend/Responsive && \
touch .make.install.npm-dependencies
FROM ghcr.io/shopware5/docker-images-testing/running:shopware_{{ shopwareVersion }}_{{ mysqlVersion }}_{{ phpVersion }}
COPY --from="js-deps" /shopware /shopware
COPY start-mysql.sh /shopware/start-mysql.sh
WORKDIR /shopware
ENV COMPOSER_ALLOW_SUPERUSER=1
ENV DB_USER=root
ENV DB_PORT=3306
ENV DB_NAME=shopware
ENV DB_HOST=127.0.0.1
ENV DB_PASSWORD=root
ENV SW_HOST=localhost
ENV SW_BASE_PATH=
COPY debug_config.php /shopware/config.php.dist
RUN ./start-mysql.sh \
&& mysqladmin --user=root password 'root'
{% if shopwareVersion < 5.7 %}
RUN composer install
RUN sed -e "s/%db\.user%/${DB_USER}/g" -e "s/%db\.password%/${DB_PASSWORD}/g" -e "s/%db\.database%/${DB_NAME}/g" -e "s/%db\.host%/${DB_HOST}/g" -e "s/%db\.port%/${DB_PORT}/g" < config.php.dist > config.php
RUN ./start-mysql.sh \
&& mysql -e "CREATE DATABASE shopware" \
&& php bin/console sw:database:setup --steps=drop,create,import,importDemodata \
&& php bin/console sw:cache:clear \
&& php bin/console sw:database:setup --steps=setupShop --shop-url="http://${SW_HOST}${SW_BASE_PATH}" \
&& php bin/console sw:snippets:to:db --include-plugins \
&& php bin/console sw:theme:initialize \
&& php bin/console sw:firstrunwizard:disable \
&& php bin/console sw:admin:create --name="Demo" --email="[email protected]" --username="demo" --password="demo" --locale="de_DE" -n \
&& touch recovery/install/data/install.lock
RUN npm install --prefix ./themes && npm install --prefix ./themes/Frontend/Responsive
{% else %}
RUN ./start-mysql.sh && mysql -e "CREATE DATABASE shopware" && make init && make .make.install.npm-dependencies
{% endif %}
{% if consentManagerRequired %}
RUN ./start-mysql.sh \
&& php bin/console sw:plugin:refresh \
&& php bin/console sw:plugin:install SwagCookieConsentManager
{% endif %}
COPY --chown="root:root" entrypoint.sh /entrypoint.sh
RUN chown -R www-data:www-data /shopware
ENTRYPOINT ["bash", "-c", "/entrypoint.sh"]
{#RUN php bin/console sw:cache:clear#}