Skip to content

Commit 0b6bd3c

Browse files
committed
BKDK-265 Added docker-compose stack. Drupal has to be run as separate image. See ./.docker/os2web/Dockerfile.
1 parent 6f72f2c commit 0b6bd3c

File tree

11 files changed

+198
-3
lines changed

11 files changed

+198
-3
lines changed

.docker/logs/apt/eipp.log.xz

10.5 KB
Binary file not shown.

.docker/mariadb/data/.gitkeep

Whitespace-only changes.

.docker/mariadb/my.cnf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# MariaDB database server configuration file.
2+
#
3+
# You can use this file to overwrite the default configuration
4+
#
5+
# For explanations see
6+
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

.docker/os2web/Dockerfile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
FROM drupal:8-apache-buster
2+
3+
# Installing additional dependencies.
4+
RUN set -eux; \
5+
apt update; \
6+
apt install libxml2-dev git -y; \
7+
docker-php-ext-install mysqli soap; \
8+
curl -fsSL "https://github.com/drush-ops/drush-launcher/releases/latest/download/drush.phar" -o /usr/local/bin/drush && chmod +x /usr/local/bin/drush
9+
10+
# Removing standard Drupal core and loading OS2Web project.
11+
WORKDIR /opt
12+
# Getting recent state of master branch.
13+
ARG OS2WEB_TAG
14+
RUN set -eux; \
15+
rm -rf drupal; \
16+
git clone --single-branch --branch master https://github.com/OS2web/os2web8.git drupal
17+
WORKDIR /opt/drupal
18+
19+
# Loading composer dependencies and configuring project folders.
20+
RUN set -eux; \
21+
export COMPOSER_HOME="$(mktemp -d)"; \
22+
composer global require hirak/prestissimo;\
23+
COMPOSER_MEMORY_LIMIT=-1 composer install; \
24+
chown -R www-data:www-data web/sites web/modules web/themes; \
25+
# delete composer cache.
26+
rm -rf "$COMPOSER_HOME"
27+
28+
# Adding further site specific data to image.
29+
RUN echo '<?php $settings["project_env"] = PROD_ENV; ' > /opt/drupal/web/sites/default/env.settings.php; \
30+
# Adding files directories.
31+
mkdir -p files; \
32+
rm -rf /opt/drupal/web/sites/default/files; \
33+
ln -sf /opt/drupal/files /opt/drupal/web/sites/default/files; \
34+
mkdir -p private; \
35+
chown -R www-data:www-data /opt/drupal/private /opt/drupal/files
36+
37+
COPY settings/prod.settings.php /opt/drupal/web/sites/default/
38+
COPY entrypoint.sh /
39+
40+
ENTRYPOINT ["/entrypoint.sh"]

.docker/os2web/build.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
docker build ./ -t os2web

.docker/os2web/entrypoint.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash
2+
if [ "$WAIT_ON_MYSQL" = true ]; then
3+
echo "Waiting mysql service 10s"
4+
sleep 10
5+
fi;
6+
7+
if [ "$PRINT_STATUS" = true ]; then
8+
echo "drush status"
9+
export DRUSH="drush --root=/opt/drupal"
10+
$DRUSH status
11+
fi;
12+
13+
if [ "$INSTALL_OS2WEB" = true ]; then
14+
echo "Installing new OS2Web installation"
15+
export DRUSH="drush --root=/opt/drupal"
16+
# Install drupal.
17+
$DRUSH sql-drop -y
18+
$DRUSH si os2web --account-pass=admin --locale=da -y
19+
20+
# Enable theme.
21+
if [ -z "$OS2WEB_THEME" ]; then
22+
export OS2WEB_THEME="fds_custom_theme"
23+
fi;
24+
$DRUSH theme:enable $OS2WEB_THEME -y
25+
$DRUSH config-set system.theme default $OS2WEB_THEME -y
26+
27+
# Enable modules.
28+
$DRUSH en -y os2web_pagebuilder os2web_spotbox
29+
else
30+
echo "Updating project files skipped"
31+
fi;
32+
33+
if [ "$DEPLOYMENT" = true ]; then
34+
echo "Running deployment"
35+
export DRUSH="drush --root=/opt/drupal"
36+
$DRUSH cr
37+
$DRUSH updb -y
38+
else
39+
echo "Deployment skipped"
40+
fi;
41+
42+
apache2-foreground

.docker/os2web/logs/.keep

Whitespace-only changes.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
/**
3+
* @file
4+
* Local development override configuration feature.
5+
*
6+
* To activate this feature, copy and rename it such that its path plus
7+
* filename is 'sites/default/settings.local.php'. Then, go to the bottom of
8+
* 'sites/default/settings.php' and uncomment the commented lines that mention
9+
* 'settings.local.php'.
10+
*
11+
* If you are using a site name in the path, such as 'sites/example.com', copy
12+
* this file to 'sites/example.com/settings.local.php', and uncomment the lines
13+
* at the bottom of 'sites/example.com/settings.php'.
14+
*/
15+
16+
$databases['default']['default'] = [
17+
'database' => getenv('MYSQL_DATABASE'),
18+
'driver' => 'mysql',
19+
'host' => getenv('MYSQL_HOSTNAME'),
20+
'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
21+
'password' => getenv('MYSQL_PASSWORD'),
22+
'port' => getenv('MYSQL_PORT'),
23+
'prefix' => '',
24+
'username' => getenv('MYSQL_USER'),
25+
];
26+
27+
$settings['hash_salt'] = getenv('DRUPAL_HASH_SALT');
28+
29+
$settings['file_temp_path'] = '/tmp';
30+
$settings['file_private_path'] = '../private';
31+

.env.example

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,5 @@
2222
# MYSQL_PASSWORD=
2323
# MYSQL_PORT=
2424
# MYSQL_USER=
25-
26-
# Another common use case is to set Drush's --uri via environment.
27-
# DRUSH_OPTIONS_URI=http://example.com
25+
# DRUPAL_HASH_SALT=
26+
# OS2WEB_THEME=

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616

1717
# Ignore Drupal's file directory
1818
/web/sites/*/files/
19+
/files
20+
!/files/.gitkeep
21+
/private
22+
!/private/.gitkeep
1923

2024
# Ignore config files. Accordingly to bussines requirements we should not store
2125
# configuration files in git.
@@ -40,3 +44,10 @@
4044
*.log
4145
*.sql
4246
*.sql.gz
47+
48+
# docker/docksal
49+
logs/*.log
50+
.docker/logs/*.log
51+
.docker/php/logs/*.log
52+
.docker/mariadb/data/*
53+
!.docker/mariadb/data/.gitkeep

0 commit comments

Comments
 (0)