-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BKDK-265 Added docker-compose stack. Drupal has to be run as separate…
… image. See ./.docker/os2web/Dockerfile.
- Loading branch information
Showing
11 changed files
with
198 additions
and
3 deletions.
There are no files selected for viewing
Binary file not shown.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# MariaDB database server configuration file. | ||
# | ||
# You can use this file to overwrite the default configuration | ||
# | ||
# For explanations see | ||
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
FROM drupal:8-apache-buster | ||
|
||
# Installing additional dependencies. | ||
RUN set -eux; \ | ||
apt update; \ | ||
apt install libxml2-dev git -y; \ | ||
docker-php-ext-install mysqli soap; \ | ||
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 | ||
|
||
# Removing standard Drupal core and loading OS2Web project. | ||
WORKDIR /opt | ||
# Getting recent state of master branch. | ||
ARG OS2WEB_TAG | ||
RUN set -eux; \ | ||
rm -rf drupal; \ | ||
git clone --single-branch --branch master https://github.com/OS2web/os2web8.git drupal | ||
WORKDIR /opt/drupal | ||
|
||
# Loading composer dependencies and configuring project folders. | ||
RUN set -eux; \ | ||
export COMPOSER_HOME="$(mktemp -d)"; \ | ||
composer global require hirak/prestissimo;\ | ||
COMPOSER_MEMORY_LIMIT=-1 composer install; \ | ||
chown -R www-data:www-data web/sites web/modules web/themes; \ | ||
# delete composer cache. | ||
rm -rf "$COMPOSER_HOME" | ||
|
||
# Adding further site specific data to image. | ||
RUN echo '<?php $settings["project_env"] = PROD_ENV; ' > /opt/drupal/web/sites/default/env.settings.php; \ | ||
# Adding files directories. | ||
mkdir -p files; \ | ||
rm -rf /opt/drupal/web/sites/default/files; \ | ||
ln -sf /opt/drupal/files /opt/drupal/web/sites/default/files; \ | ||
mkdir -p private; \ | ||
chown -R www-data:www-data /opt/drupal/private /opt/drupal/files | ||
|
||
COPY settings/prod.settings.php /opt/drupal/web/sites/default/ | ||
COPY entrypoint.sh / | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
docker build ./ -t os2web |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/bash | ||
if [ "$WAIT_ON_MYSQL" = true ]; then | ||
echo "Waiting mysql service 10s" | ||
sleep 10 | ||
fi; | ||
|
||
if [ "$PRINT_STATUS" = true ]; then | ||
echo "drush status" | ||
export DRUSH="drush --root=/opt/drupal" | ||
$DRUSH status | ||
fi; | ||
|
||
if [ "$INSTALL_OS2WEB" = true ]; then | ||
echo "Installing new OS2Web installation" | ||
export DRUSH="drush --root=/opt/drupal" | ||
# Install drupal. | ||
$DRUSH sql-drop -y | ||
$DRUSH si os2web --account-pass=admin --locale=da -y | ||
|
||
# Enable theme. | ||
if [ -z "$OS2WEB_THEME" ]; then | ||
export OS2WEB_THEME="fds_custom_theme" | ||
fi; | ||
$DRUSH theme:enable $OS2WEB_THEME -y | ||
$DRUSH config-set system.theme default $OS2WEB_THEME -y | ||
|
||
# Enable modules. | ||
$DRUSH en -y os2web_pagebuilder os2web_spotbox | ||
else | ||
echo "Updating project files skipped" | ||
fi; | ||
|
||
if [ "$DEPLOYMENT" = true ]; then | ||
echo "Running deployment" | ||
export DRUSH="drush --root=/opt/drupal" | ||
$DRUSH cr | ||
$DRUSH updb -y | ||
else | ||
echo "Deployment skipped" | ||
fi; | ||
|
||
apache2-foreground |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
/** | ||
* @file | ||
* Local development override configuration feature. | ||
* | ||
* To activate this feature, copy and rename it such that its path plus | ||
* filename is 'sites/default/settings.local.php'. Then, go to the bottom of | ||
* 'sites/default/settings.php' and uncomment the commented lines that mention | ||
* 'settings.local.php'. | ||
* | ||
* If you are using a site name in the path, such as 'sites/example.com', copy | ||
* this file to 'sites/example.com/settings.local.php', and uncomment the lines | ||
* at the bottom of 'sites/example.com/settings.php'. | ||
*/ | ||
|
||
$databases['default']['default'] = [ | ||
'database' => getenv('MYSQL_DATABASE'), | ||
'driver' => 'mysql', | ||
'host' => getenv('MYSQL_HOSTNAME'), | ||
'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql', | ||
'password' => getenv('MYSQL_PASSWORD'), | ||
'port' => getenv('MYSQL_PORT'), | ||
'prefix' => '', | ||
'username' => getenv('MYSQL_USER'), | ||
]; | ||
|
||
$settings['hash_salt'] = getenv('DRUPAL_HASH_SALT'); | ||
|
||
$settings['file_temp_path'] = '/tmp'; | ||
$settings['file_private_path'] = '../private'; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
version: '3.7' | ||
|
||
networks: | ||
frontend: | ||
driver: bridge | ||
backend: | ||
driver: bridge | ||
|
||
volumes: | ||
mysql: | ||
driver: local | ||
|
||
services: | ||
|
||
php: | ||
image: os2web | ||
container_name: php | ||
volumes: | ||
# - ./:/opt/drupal | ||
- ./.docker/logs:/var/log:delegated | ||
- ./files:/opt/drupal/files | ||
- ./private:/opt/drupal/private | ||
depends_on: | ||
- mariadb | ||
ports: | ||
- "8080:80" | ||
networks: | ||
- backend | ||
- frontend | ||
environment: | ||
## Environment sensitive settings. See .env file. | ||
- MYSQL_HOSTNAME=${MYSQL_HOSTNAME} | ||
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD} | ||
- MYSQL_DATABASE=${MYSQL_DATABASE} | ||
- MYSQL_USER=${MYSQL_USER} | ||
- MYSQL_PASSWORD=${MYSQL_PASSWORD} | ||
- MYSQL_PORT=${MYSQL_PORT} | ||
- DRUPAL_HASH_SALT=${DRUPAL_HASH_SALT} | ||
- OS2WEB_THEME=${OS2WEB_THEME} | ||
|
||
## Deployment sensitive settings. See .docker/os2web/entrypoint.sh | ||
# This flag is used to set delay for getting MYSQL service ready. | ||
- WAIT_ON_MYSQL=true | ||
# Runs "drush status" command. | ||
- PRINT_STATUS=true | ||
# Runs deployment action: drush updb, drush cr etc. | ||
- DEPLOYMENT=true | ||
# WARNING: It will drop existing database and reinstall Drupal. | ||
- INSTALL_OS2WEB=true | ||
|
||
mariadb: | ||
image: mariadb:latest | ||
container_name: mariadb | ||
volumes: | ||
- ./.docker/mariadb/data:/var/lib/mysql:delegated | ||
- ./.docker/mariadb/my.cnf:/etc/mysql/conf.d/my.cnf:ro,delegated | ||
environment: | ||
## Environment sensitive settings. See .env file. | ||
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD} | ||
- MYSQL_DATABASE=${MYSQL_DATABASE} | ||
- MYSQL_USER=${MYSQL_USER} | ||
- MYSQL_PASSWORD=${MYSQL_PASSWORD} | ||
networks: | ||
- backend |