Skip to content

Instantly share code, notes, and snippets.

@back-2-95
Last active March 22, 2024 07:19
Show Gist options
  • Save back-2-95/ab8f16dea7ff2222966613392ee88ce3 to your computer and use it in GitHub Desktop.
Save back-2-95/ab8f16dea7ff2222966613392ee88ce3 to your computer and use it in GitHub Desktop.
Create Drupal contribution setup using Stonehenge
DRUPAL_HOSTNAME=drupal-contribute.docker.so

Drupal contribute Spell

git clone --branch 10.2.4 https://git.drupalcode.org/project/drupal.git public
cp example.gitignore public/.gitignore
docker compose up --wait
docker compose exec app composer install --working-dir=/app/public
docker compose exec app composer require --working-dir=/app/public drush/drush
cp settings.php public/sites/default/settings.php
docker compose exec app /app/public/vendor/bin/drush site:install -y
docker compose exec app /app/public/vendor/bin/drush uli

Open https://drupal-contribute.docker.so/

services:
app:
container_name: ${COMPOSE_PROJECT_NAME}-app
hostname: ${COMPOSE_PROJECT_NAME}
image: druidfi/drupal-web:v8.3.4
volumes:
- .:/app:delegated
environment:
APP_ENV: ${APP_ENV:-dev}
DRUSH_OPTIONS_URI: https://${DRUPAL_HOSTNAME}
PHP_SENDMAIL_PATH: /usr/sbin/sendmail -S host.docker.internal:1025 -t
SIMPLETEST_BASE_URL: http://app:8080
SIMPLETEST_DB: mysql://drupal:drupal@db:3306/drupal
XDEBUG_ENABLE: ${XDEBUG_ENABLE:-false}
labels:
- "traefik.enable=true"
- "traefik.http.routers.${COMPOSE_PROJECT_NAME}-app.entrypoints=https"
- "traefik.http.routers.${COMPOSE_PROJECT_NAME}-app.rule=Host(`${DRUPAL_HOSTNAME}`)"
- "traefik.http.routers.${COMPOSE_PROJECT_NAME}-app.tls=true"
- "traefik.http.services.${COMPOSE_PROJECT_NAME}-app.loadbalancer.server.port=8080"
- "traefik.docker.network=traefik-network"
extra_hosts:
- "host.docker.internal:host-gateway"
networks:
- default
- traefik-network
db:
container_name: ${COMPOSE_PROJECT_NAME}-db
image: druidfi/mariadb:10.11-drupal-lts
ports:
- 3306
networks:
default:
name: ${COMPOSE_PROJECT_NAME}
external: false
traefik-network:
name: stonehenge-network
external: true
<?php
$databases['default']['default'] = [
'database' => getenv('DRUPAL_DB_NAME'),
'username' => getenv('DRUPAL_DB_USER'),
'password' => getenv('DRUPAL_DB_PASS'),
'host' => getenv('DRUPAL_DB_HOST'),
'port' => getenv('DRUPAL_DB_PORT'),
'driver' => 'mysql',
'prefix' => '',
'collation' => 'utf8mb4_general_ci',
];
$settings['skip_permissions_hardening'] = TRUE;
$settings['trusted_host_patterns'][] = '^drupal-contribute.docker.so$';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment