forked from dockware/dockware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.global.sh.twig
598 lines (491 loc) · 22.4 KB
/
Dockerfile.global.sh.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
# Official Dockware Image
# Tag: {{ orca.tag }}
# Copyright 2022 dasistweb GmbH
#
FROM {{ base_image }}
LABEL title="Dockware {{ orca.image }}:{{ orca.tag }}" \
version="{{version}}" \
maintainer="dasistweb GmbH"
# remember build-date
RUN date >/build-date.txt && \
mkdir -p /var/www && \
mkdir -p /var/www/scripts
# add our changelog to the containers
ADD ./assets/CHANGELOG.md /var/www/CHANGELOG.md
{% block image_variables %}
## ***********************************************************************
## IMAGE VARIABLES
## ***********************************************************************
{% block image_variables_main %}
ENV TZ Europe/Berlin
ENV PHP_VERSION {{php.default_version}}
ENV APACHE_DOCROOT {{ apache.docroot }}
ENV SW_TASKS_ENABLED 0
ENV COMPOSER_VERSION not-set
ENV NODE_VERSION {{ node.version }}
ENV SHOP_DOMAIN localhost
ENV RECOVERY_MODE 0
RUN echo "export TZ=${TZ}" >> /etc/profile \
&& echo "export PHP_VERSION=${PHP_VERSION}" >> /etc/profile \
&& echo "export APACHE_DOCROOT=${APACHE_DOCROOT}" >> /etc/profile \
&& echo "export SW_TASKS_ENABLED=${SW_TASKS_ENABLED}" >> /etc/profile \
&& echo "export COMPOSER_VERSION=${COMPOSER_VERSION}" >> /etc/profile \
&& echo "export NODE_VERSION=${NODE_VERSION}" >> /etc/profile \
&& echo "export SHOP_DOMAIN=${SHOP_DOMAIN}" >> /etc/profile \
&& echo "export RECOVERY_MODE=${RECOVERY_MODE}" >> /etc/profile
{% endblock %}
{% block image_variables_dev %}
ENV SSH_USER not-set
ENV SSH_PWD not-set
ENV XDEBUG_REMOTE_HOST "host.docker.internal"
ENV XDEBUG_CONFIG "idekey=PHPSTORM"
ENV PHP_IDE_CONFIG "serverName=localhost"
ENV XDEBUG_ENABLED 0
ENV FILEBEAT_ENABLED 0
ENV TIDEWAYS_KEY not-set
ENV TIDEWAYS_ENV production
COPY ./config/php/general.ini /tmp/general.ini
COPY ./config/php/cli.ini /tmp/cli.ini
COPY ./config/tideways/tideways.ini /tmp/tideways.ini
RUN echo "export SSH_USER=${SSH_USER}" >> /etc/profile \
&& echo "export SSH_PWD=${SSH_PWD}" >> /etc/profile \
&& echo "export XDEBUG_ENABLED=${XDEBUG_ENABLED}" >> /etc/profile \
&& echo "export XDEBUG_REMOTE_HOST=${XDEBUG_REMOTE_HOST}" >> /etc/profile \
&& echo "export XDEBUG_CONFIG=${XDEBUG_CONFIG}" >> /etc/profile \
&& echo "export PHP_IDE_CONFIG=${PHP_IDE_CONFIG}" >> /etc/profile \
&& echo "export FILEBEAT_ENABLED=${FILEBEAT_ENABLED}" >> /etc/profile \
&& echo "export TIDEWAYS_KEY=${TIDEWAYS_KEY}" >> /etc/profile \
&& echo "export TIDEWAYS_ENV=${TIDEWAYS_ENV}" >> /etc/profile
{% endblock %}
{% block image_variables_mysql %}
ENV MYSQL_USER not-set
ENV MYSQL_PWD not-set
RUN echo "export MYSQL_USER=${MYSQL_USER}" >> /etc/profile \
&& echo "export MYSQL_PWD=${MYSQL_PWD}" >> /etc/profile
{% endblock %}
{% block image_variables_sw_currency %}
ENV SW_CURRENCY 'not-set'
RUN echo "export SW_CURRENCY=${SW_CURRENCY}" >> /etc/profile
{% endblock %}
{% block image_variables_sw_api_access_key %}
ENV SW_API_ACCESS_KEY 'not-set'
RUN echo "export SW_API_ACCESS_KEY=${SW_API_ACCESS_KEY}" >> /etc/profile
{% endblock %}
{% endblock %}
## ***********************************************************************
## BASE REQUIREMENTS
## ***********************************************************************
RUN apt-get update \
{% block base %}
&& apt-get install -y gosu \
&& apt-get install -y sudo \
&& apt-get install -y wget \
&& apt-get install -y curl \
&& apt-get install -y unzip \
&& apt-get install -y bzip2 \
&& apt-get install -y ssmtp \
&& apt-get install -y lsof \
&& apt-get install -y openssh-server \
&& apt-get install -y cron \
&& apt-get install -y vim \
&& apt-get install -y nano \
&& apt-get install -y jq \
&& apt-get install -y gnupg2 \
&& apt-get install -y gpg-agent \
&& apt-get install -y chromium-browser \
&& mkdir /var/run/sshd \
# TIMEZONE SETTINGS
# otherwise we would have an interactive input dialog
&& ln -fs /usr/share/zoneinfo/Europe/Berlin /etc/localtime \
{% block base_tzdata %}
&& apt-get install -y tzdata \
&& dpkg-reconfigure --frontend noninteractive tzdata \
{% endblock %} \
{% block base_xdg %}
&& apt-get install -y xdg-utils \
{% endblock %}
{% block base_sodium %}
&& apt-get install -y libsodium-dev \
&& apt-get install -y php-dev \
&& apt-get install -y php-pear \
&& pecl install -f libsodium \
&& apt-get remove -y php-pear \
&& apt-get remove -y php-dev \
{% endblock %}
{% endblock %}
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*
{% block users %}
## ***********************************************************************
## USER MANAGEMENT
## ***********************************************************************
{% block users_setup %}
# set easy root pwd for dev purpose
RUN echo "root:root" | chpasswd \
# set password for www-data, and also
# avoid shell login (we have a separate user for that)
&& echo 'www-data:www-data' | chpasswd \
&& usermod -s /usr/sbin/nologin www-data \
# this option makes sure to avoid root SSH login
# we just replace our lines with nothing
&& sed -i 's/PermitRootLogin without-password//' /etc/ssh/sshd_config \
&& sed -i 's/PermitRootLogin prohibit-password//' /etc/ssh/sshd_config \
# allow root and sudo group to run sudo without password
&& sed -i /etc/sudoers -re 's/^%sudo.*/%sudo ALL=(ALL:ALL) NOPASSWD: ALL/g' \
&& sed -i /etc/sudoers -re 's/^root.*/root ALL=(ALL:ALL) NOPASSWD: ALL/g' \
# remove include directory
&& sed -i /etc/sudoers -re 's/^#includedir.*/## **Removed the include directive** ##"/g'
{% endblock %}
{% block users_ssh_add %}
{% include 'template/components/ssh/add_user.sh.twig' with {'user': ssh.user.name, 'pwd' : ssh.user.pwd, 'sudo' : true } %}
{% endblock %}
{% block users_ssh_connection %}
RUN echo 'AllowUsers {{ ssh.user.name }}' >> /etc/ssh/sshd_config
{% endblock %}
{% block users_bashrc %}
ENV BASH_ENV /var/www/.bashrc
RUN echo "source /var/www/.nvm/nvm.sh" >> /var/www/.bashrc \
# -------------------------------------------------
&& chown 33:33 /var/www/.bashrc \
# -------------------------------------------------
&& echo "export BASH_ENV=${BASH_ENV}" >> /etc/profile
{% endblock %}
{% endblock %}
{% block apache %}
## ***********************************************************************
## APACHE INSTALLATION
## ***********************************************************************
#this conf is needed for enconf command ...
ADD ./config/apache/http2.conf /etc/apache2/conf-available/http2.conf
{% include 'template/components/apache2/install.sh.twig' %}
ADD ./config/apache/apache2.conf /etc/apache2/apache2.conf
ADD ./config/apache/ports.conf /etc/apache2/ports.conf
ADD ./config/apache/sites.conf /etc/apache2/sites-enabled/000-default.conf
{% endblock %}
# create a new id_rsa for the www-data dockeruser.
# thus we have a SSH Key for connections out of the box
{% set id_rsa_vars = { 'user' : 'www-data', 'group' : 'www-data', 'directory': '/var/www/.ssh', 'comment' : 'Dockware Container'} %}
{% include 'template/components/ssh/create_key.sh.twig' with id_rsa_vars %}
{% block php %}
## ***********************************************************************
## PHP INSTALLATION
## ***********************************************************************
RUN apt-get update \
{% for key,value in php.versions %}
{% if value.active == true %}
{% include "template/components/php/#{ key }/install.sh.twig" %}
&& cat /tmp/general.ini >| /etc/php/{{ key }}/fpm/conf.d/01-general.ini \
&& cat /tmp/general.ini >| /etc/php/{{ key }}/cli/conf.d/01-general.ini \
&& cat /tmp/cli.ini >| /etc/php/{{ key }}/cli/conf.d/01-general-cli.ini \
{% endif %}
{% endfor %}
# remove pecl again
&& apt-get remove -y dh-php \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*
#make sure the installation runs also in default php version
RUN sudo update-alternatives --set php /usr/bin/php{{ php.default_version }} > /dev/null 2>&1 &
# make sure the installation runs using our default php version
RUN service php{{ php.default_version }}-fpm stop > /dev/null 2>&1 && \
service php{{ php.default_version }}-fpm start && \
sudo update-alternatives --set php /usr/bin/php{{ php.default_version }} > /dev/null 2>&1 \
# make sure our php user has rights on the session
&& chown www-data:www-data -R /var/lib/php/sessions
{% endblock %}
# remove the standard apache index file
RUN mkdir -p /var/www/html \
&& rm -rf /var/www/html/* \
&& chown -R www-data:www-data /var/www/html \
&& sudo -u www-data sh -c 'mkdir -p /var/www/html/public'
{% block permissions %}
# make sure the configured log folder exists and is writeable
RUN chmod -R 0777 /var/www \
&& chgrp -R www-data /var/log/apache2 \
&& mkdir -p /var/log/mysql \
&& chgrp -R www-data /var/log/mysql\
&& mkdir /var/log/php -p \
&& touch /var/log/php/cli_errors.log \
&& touch /var/log/php/fpm_errors.log \
&& chown -R www-data:www-data /var/log/php \
&& chmod 0755 /var/log/php
{% endblock %}
{% block ssl %}
## ***********************************************************************
## MOD_SSL
## create SSL certificate
## ***********************************************************************
RUN apt-get update \
&& apt-get install -y openssl \
&& a2enmod ssl \
&& mkdir /etc/apache2/ssl \
&& openssl req -new -x509 -days 365 -sha1 -newkey rsa:2048 -nodes -keyout /etc/apache2/ssl/server.key -out /etc/apache2/ssl/server.crt -subj '/O=Company/OU=Department/CN=localhost' \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*
{% endblock %}
{% block components %}
RUN apt-get update \
{% block components_dev_tools %}
&& apt-get install -y rsync \
&& apt-get install -y sshpass \
&& apt-get install -y jpegoptim \
&& apt-get install -y screen \
&& apt-get install -y mysql-client \
{% endblock %}
{% block components_git %}
&& apt-get install -y git
{% endblock %}
{% block components_packagers %}
{% block components_packagers_composer %}
{% if composer.version == 1 %}
{% include 'template/components/composer/v1/install.sh.twig' %}
{% else %}
{% include 'template/components/composer/v2/install.sh.twig' %}
{% endif %}
{% endblock %}
{% endblock %}
{% block components_xdebug %}
RUN cd /var/www \
&& apt-get update \
{% for key, value in php.versions %}
{% if value.active and value.xdebug_version != '' %}
{% include 'template/components/xdebug/install.sh.twig' with { "php_version" : key,"folder_id" : value.folder_id, "xdebug_tag":value.xdebug_tag} %}
{% endif %}
{% endfor %}
&& sudo apt-get install -y zlib1g-dev \
&& sudo rm -rf /var/lib/apt/lists/* /var/cache/apt/* \
&& sudo rm -rf /var/www/xdebug
#generate xdebug ini files
{% for key, value in php.versions %}
{% if value.active and value.xdebug_version != '' %}
{% include 'template/components/xdebug/generate_ini_files.sh.twig' with { "version" : key, "folder_id" : value.folder_id ,"xdebug_version":value.xdebug_version} %}
{% endif %}
{% endfor %}
RUN cd /var/www \
{% for key, value in php.versions %}
{% if value.active and value.xdebug_version != '' %}
{% include 'template/components/xdebug/edit_ini_files.sh.twig' with { "version" : key, "folder_id" : value.folder_id ,"xdebug_version":value.xdebug_version} %}
{% endif %}
{% endfor %}
&& cd /var/www
{% endblock %}
{% block components_mysql %}
{% include 'template/components/mysql/' ~ mysql.version ~ '/install.sh.twig' with { 'pwd' : db.pwd } %}
{% endblock %}
{% block components_adminer %}
{% include 'template/components/adminer/install.sh.twig' %}
{% endblock %}
{% block components_mailcatcher %}
{% include 'template/components/mailcatcher/install.sh.twig' %}
RUN {% for key,value in php.versions %}
{% if value.active==true %}
echo "sendmail_path = /usr/bin/env $(which catchmail) -f 'local@dockware'" >> /etc/php/{{ key }}/mods-available/mailcatcher.ini && \
{% endif %}
{% endfor %}
echo ""
{% endblock %}
{% block components_pimpmylog %}
RUN mkdir -p /var/www/pimpmylog && \
wget -O - https://github.com/potsky/PimpMyLog/tarball/master | tar xzf - && \
mv potsky-PimpMyLog-* /var/www/pimpmylog && \
mv /var/www/pimpmylog/potsky-PimpMyLog-2fed8c1/* /var/www/pimpmylog && \
rm -rf /var/www/pimpmylog/potsky-PimpMyLog-*
COPY /config/pimpmylog/config.user.d /var/www/pimpmylog/config.user.d
COPY /config/pimpmylog/config.user.json /var/www/pimpmylog/config.user.json
# apply our custom file with fixes for PHP 8
# its used from here: https://github.com/potsky/PimpMyLog/pull/149/files
COPY /config/pimpmylog/global.inc.php /var/www/pimpmylog/inc/global.inc.php
RUN chown -R www-data:www-data /var/www/pimpmylog/
{% endblock %}
{% block components_filebeat %}
RUN apt-get update \
&& wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | apt-key add - \
&& apt-get install -y apt-transport-https \
&& echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | tee -a /etc/apt/sources.list.d/elastic-7.x.list \
&& apt-get update && apt-get install filebeat \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*
{% endblock %}
{% block components_nvm %}
RUN ls -la \
&& mkdir "/var/www/.nvm" \
&& export NVM_DIR="/var/www/.nvm" \
# -----------------------------------------------------------------------------------------
&& curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash \
# -----------------------------------------------------------------------------------------
&& [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" \
&& [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" \
# -----------------------------------------------------------------------------------------
{% for key,nodeEntry in node.packages %}
{% if nodeEntry.active == true %}
&& nvm install {{ nodeEntry.version }} \
{% endif %}
{% endfor %}
# -----------------------------------------------------------------------------------------
# we have to install yarn in additional node versions
# otherwise it won't be found after a nvm switch
{% for key,nodeEntry in node.packages %}
{% if nodeEntry.active == true %}
&& nvm use {{ nodeEntry.version }} && npm install -g yarn \
{% endif %}
{% endfor %}
# -----------------------------------------------------------------------------------------
&& nvm use {{ node.version }} \
&& nvm alias default {{ node.version }} \
# -----------------------------------------------------------------------------------------
&& echo ""
ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
ENV PATH $NVM_DIR/v$NODE_VERSION/bin:$PATH
{% endblock %}
RUN echo "" \
{% block components_node %}
# -----------------------------------------------------------
# we have to reload the correct nvm version otherwise this would destroy it
&& export NVM_DIR="/var/www/.nvm" \
&& [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" \
&& [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" \
&& nvm use {{ node.version }} \
# -----------------------------------------------------------
&& mkdir /var/www/.npm \
&& npm config set cache /var/www/.npm \
&& chown 33:33 /var/www/.npm \
{% endblock %}
{% block components_grunt %}
# navigate to another folder outside shopware to avoid this error: npm ERR! Tracker "idealTree" already exists
&& cd /var/www && npm install -g grunt-cli \
&& cd /var/www && npm install grunt --save-dev \
{% endblock %}
{% block components_packagers_yarn %}
&& npm install -g --no-install-recommends yarn \
&& chown -R www-data:www-data /var/www/.composer \
{% endblock %}
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*
{% block components_tideways %}
COPY ./assets/tideways/tideways-daemon /etc/init.d/tideways-daemon
COPY ./config/tideways/tideways-daemon /etc/default/tideways-daemon
RUN sudo echo 'deb https://packages.tideways.com/apt-packages-main any-version main' | sudo tee /etc/apt/sources.list.d/tideways.list \
&& sudo wget -qO - https://packages.tideways.com/key.gpg | sudo apt-key add - \
&& sudo apt-get -y update \
&& sudo apt-get -y install tideways-php tideways-daemon \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/* \
&& sudo chmod 0755 /etc/init.d/tideways-daemon \
{% for key,value in php.versions %}
{% if value.active == true %}
&& cat /tmp/tideways.ini >| /etc/php/{{ key }}/fpm/conf.d/20-tideways.ini \
&& cat /tmp/tideways.ini >| /etc/php/{{ key }}/cli/conf.d/20-tideways.ini \
{% endif %}
{% endfor %}
&& rm -rf /tmp/tideways.ini
{% endblock %}
{% endblock %}
{% block assets_install %}
COPY ./assets/scripts/makefile /var/www/makefile
COPY ./assets/scripts/bin /var/www/scripts/bin
COPY ./assets/scripts/cron /var/www/scripts/cron
{% block assets_install_shopware6 %}
COPY ./assets/shopware6/files /var/www/scripts/shopware6
{% endblock %}
{% endblock %}
ADD entrypoint.sh /entrypoint.sh
RUN chown www-data:www-data -R /var/www/scripts && \
#make sure for the whole installation xdebug is off for performance
sh /var/www/scripts/bin/xdebug_disable.sh && \
chmod 755 /*.sh
{% block shopware %}
{% block shopware_install %}
## ***********************************************************************
## INSTALL SHOPWARE
## ***********************************************************************
RUN rm -rf /var/www/html/* \
&& wget --no-check-certificate {{ shopware.download_url }} -qq -O /var/www/shopware.zip \
&& unzip -q /var/www/shopware.zip -d /var/www/html \
&& rm -rf /var/www/shopware.zip
{% endblock %}
{% block shopware_prepare %}
{% block shopware_prepare_env %}
RUN echo "APP_ENV={{ shopware.env }}" >> /var/www/html/.env && \
echo "APP_SECRET=1" >> /var/www/html/.env && \
echo "INSTANCE_ID=1" >> /var/www/html/.env && \
echo "DATABASE_URL=mysql://{{ db.user }}:{{ db.pwd }}@{{ db.host }}:{{ db.port }}/{{ db.database }}" >> /var/www/html/.env && \
echo "APP_URL={{ shopware.url }}" >> /var/www/html/.env && \
echo "MAILER_URL=smtp://localhost:1025" >> /var/www/html/.env && \
echo "COMPOSER_HOME=/var/www/html/var/cache/composer" >> /var/www/html/.env && \
echo "SHOPWARE_ES_ENABLED=0" >> /var/www/html/.env
{% endblock %}
{% block shopware_setup %}
RUN sudo service mysql start && \
# switch to default PHP before installing
sudo update-alternatives --set php /usr/bin/php{{ php.default_version }} > /dev/null 2>&1 && \
# -------------------------------------------------------------------------------------------
cd /var/www/html && php bin/console system:install --create-database --basic-setup && \
# make sure assets like logos are ready
cd /var/www/html && php bin/console assets:install && \
rm -rf /var/www/html/config/jwt/private.pem && \
rm -rf /var/www/html/config/jwt/public.pem && \
cd /var/www/html && php bin/console system:generate-jwt-secret && \
# -------------------------------------------------------------------------------------------
# add some demo data
{% if version_gte(shopware.version, '6.2.0-rc1') %}
cd /var/www/html && APP_ENV=prod php bin/console store:download -p SwagPlatformDemoData && \
cd /var/www/html && APP_ENV=prod php bin/console plugin:refresh && \
cd /var/www/html && APP_ENV=prod php bin/console plugin:install --activate SwagPlatformDemoData && \
{% else %}
# -------------------------------------------------------------------------------------------
cd /var/www/html && APP_ENV=prod php bin/console framework:demodata && \
{% endif %}
# -------------------------------------------------------------------------------------------
# clear cache and refresh dal index to show the new demo data
cd /var/www/html && php bin/console cache:clear && \
cd /var/www/html && php bin/console dal:refresh:index && \
rm -rf /var/www/html/var/cache/* && \
# -------------------------------------------------------------------------------------------
mysql --user={{ db.user }} --password={{ db.pwd }} -e "use {{ db.database }}; INSERT INTO system_config (id, configuration_key, configuration_value, sales_channel_id, created_at, updated_at) VALUES (X'b3ae4d7111114377af9480c4a0911111', 'core.frw.completedAt', '{\"_value\": \"2019-10-07T10:46:23+00:00\"}', NULL, '2019-10-07 10:46:23.169', NULL);" && \
sudo service mysql stop
{% endblock %}
{% endblock %}
{% block shopware_dev %}
{% block shopware_dev_install %}
RUN sudo service mysql start \
# -------------------------------------------------------------------------------------------
# fix weird problem with invalid phpunit file
# without this, it cannot find an autoload and thus it
# always says "please install composer dependencies"
&& rm -rf /var/www/html/vendor/bin/phpunit \
# -------------------------------------------------------------------------------------------
&& cd /var/www/html && composer install \
# install and pre-build our admin and storefront
&& cd /var/www/html && ./bin/build.sh \
&& cd /var/www/html && php bin/console theme:compile \
&& sudo service mysql stop
{% endblock %}
{% block shopware_dev_plugin %}
COPY ./assets/shopware6/DockwareSamplePlugin /var/www/html/custom/plugins/DockwareSamplePlugin
RUN sudo service mysql start && \
cd /var/www/html && php bin/console plugin:refresh && \
cd /var/www/html && php bin/console plugin:install DockwareSamplePlugin && \
cd /var/www/html && php bin/console plugin:activate DockwareSamplePlugin && \
rm -rf /var/www/html/var/cache/* && \
sudo service mysql stop
{% endblock %}
{% endblock %}
{% endblock %}
RUN echo "" && \
{% block shopware_tools %}
{% block shopware_tools_dev_cli %}
curl -1sLf 'https://dl.cloudsmith.io/public/friendsofshopware/stable/setup.deb.sh' | sudo -E bash && sudo apt install shopware-cli && \
{% endblock %}
{% endblock %}
chown 33:33 -R /var/www/html && \
mkdir -p /var/www/.npm && chown 33:33 /var/www/.npm -R && \
# this is necessary so that our user can
# change the default nvm node version
# otherwise the persisted node version switch would not work!
mkdir -p /var/www/.nvm && chown 33:33 /var/www/.nvm -R && \
echo ""
## ***********************************************************************
## SWITCH TO NORMAL USER (NOT ROOT ANYMORE!)
## everything down here is now done as our www-data / dockware user
## just like you would do it manually in the container
## ***********************************************************************
USER {{ ssh.user.name }}
# make the apache folder the working directory
WORKDIR /var/www/html
## ***********************************************************************
## POST BUILD
## ***********************************************************************
ENTRYPOINT ["/bin/bash", "/entrypoint.sh"]