refactor: move Drupal into a subdirectory

This commit is contained in:
Oliver Davies 2022-07-12 23:35:26 +01:00
commit dac6c27241
10 changed files with 10448 additions and 0 deletions

31
.dockerignore Normal file
View file

@ -0,0 +1,31 @@
/.editorconfig
/.gitattributes
/vendor/
/web/.csslintrc
/web/.eslintignore
/web/.eslintrc.json
/web/.ht.router.php
/web/.htaccess
/web/INSTALL.txt
/web/README.md
/web/autoload.php
/web/core/
/web/example.gitignore
/web/index.php
/web/modules/README.txt
/web/profiles/README.txt
/web/robots.txt
/web/sites/*/files/
/web/sites/*/private/
/web/sites/*/services*.yml
/web/sites/*/settings*.php
/web/sites/README.txt
/web/sites/default/default.services.yml
/web/sites/default/default.settings.php
/web/sites/development.services.yml
/web/sites/example.settings.local.php
/web/sites/example.sites.php
/web/sites/simpletest/
/web/themes/README.txt
/web/update.php
/web/web.config

31
.gitignore vendored Normal file
View file

@ -0,0 +1,31 @@
/.editorconfig
/.gitattributes
/vendor/
/web/.csslintrc
/web/.eslintignore
/web/.eslintrc.json
/web/.ht.router.php
/web/.htaccess
/web/INSTALL.txt
/web/README.md
/web/autoload.php
/web/core/
/web/example.gitignore
/web/index.php
/web/modules/README.txt
/web/profiles/README.txt
/web/robots.txt
/web/sites/*/files/
/web/sites/*/private/
/web/sites/*/services*.yml
/web/sites/*/settings*.php
/web/sites/README.txt
/web/sites/default/default.services.yml
/web/sites/default/default.settings.php
/web/sites/development.services.yml
/web/sites/example.settings.local.php
/web/sites/example.sites.php
/web/sites/simpletest/
/web/themes/README.txt
/web/update.php
/web/web.config

6
Caddyfile Normal file
View file

@ -0,0 +1,6 @@
{$SERVER_NAME}
root * /var/www/html/web
php_fastcgi php-fpm:9000
encode gzip
file_server

52
Dockerfile Normal file
View file

@ -0,0 +1,52 @@
ARG PHP_VERSION=8.1
FROM php:${PHP_VERSION}-fpm-bullseye AS base
###
FROM base AS build
ENV PATH=${PATH}:/var/www/html/vendor/bin
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
WORKDIR /var/www/html
RUN useradd --create-home app \
&& chown app:app -R /var/www/html \
&& apt-get update -yqq \
&& apt-get install -yqq \
git \
libpng-dev \
mariadb-client \
unzip \
&& rm -fr /var/lib/apt/lists/* \
&& pecl install xdebug \
&& docker-php-ext-install \
gd \
opcache \
pdo_mysql \
&& docker-php-ext-enable \
xdebug
COPY tools/docker/images/php/root /
COPY --chown=app:app composer.* ./
USER app
RUN composer install --no-dev --prefer-dist --optimize-autoloader
COPY --chown=app:app . .
###
FROM build AS test
# RUN composer install \
# && phpunit
###
FROM build AS production
RUN composer install --no-dev --prefer-dist --optimize-autoloader

99
composer.json Normal file
View file

@ -0,0 +1,99 @@
{
"name": "drupal/recommended-project",
"description": "Project template for Drupal 9 projects with a relocated document root",
"type": "project",
"license": "GPL-2.0-or-later",
"homepage": "https://www.drupal.org/project/drupal",
"support": {
"docs": "https://www.drupal.org/docs/user_guide/en/index.html",
"chat": "https://www.drupal.org/node/314178"
},
"repositories": [
{
"type": "composer",
"url": "https://packages.drupal.org/8"
}
],
"require": {
"composer/installers": "^1.9",
"drupal/core-composer-scaffold": "^9.3",
"drupal/core-project-message": "^9.3",
"drupal/core-recommended": "^9.3",
"drupal/examples": "^3.0",
"drush/drush": "^11.0"
},
"conflict": {
"drupal/drupal": "*"
},
"minimum-stability": "stable",
"prefer-stable": true,
"config": {
"sort-packages": true,
"allow-plugins": {
"composer/installers": true,
"drupal/core-composer-scaffold": true,
"drupal/core-project-message": true,
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"extra": {
"drupal-scaffold": {
"locations": {
"web-root": "web/"
}
},
"installer-paths": {
"web/core": [
"type:drupal-core"
],
"web/libraries/{$name}": [
"type:drupal-library"
],
"web/modules/contrib/{$name}": [
"type:drupal-module"
],
"web/profiles/contrib/{$name}": [
"type:drupal-profile"
],
"web/themes/contrib/{$name}": [
"type:drupal-theme"
],
"drush/Commands/contrib/{$name}": [
"type:drupal-drush"
],
"web/modules/custom/{$name}": [
"type:drupal-custom-module"
],
"web/profiles/custom/{$name}": [
"type:drupal-custom-profile"
],
"web/themes/custom/{$name}": [
"type:drupal-custom-theme"
]
},
"drupal-core-project-message": {
"include-keys": [
"homepage",
"support"
],
"post-create-project-cmd-message": [
"<bg=blue;fg=white> </>",
"<bg=blue;fg=white> Congratulations, youve installed the Drupal codebase </>",
"<bg=blue;fg=white> from the drupal/recommended-project template! </>",
"<bg=blue;fg=white> </>",
"",
"<bg=yellow;fg=black>Next steps</>:",
" * Install the site: https://www.drupal.org/docs/8/install",
" * Read the user guide: https://www.drupal.org/docs/user_guide/en/index.html",
" * Get support: https://www.drupal.org/support",
" * Get involved with the Drupal community:",
" https://www.drupal.org/getting-involved",
" * Remove the plugin that prints this message:",
" composer remove drupal/core-project-message"
]
}
},
"require-dev": {
"drupal/core-dev": "^9.3"
}
}

10156
composer.lock generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,8 @@
services:
php-fpm:
extra_hosts:
- "host.docker.internal:host-gateway"
web:
ports:
- "80:80"

30
docker-compose.yaml Normal file
View file

@ -0,0 +1,30 @@
services:
web:
image: caddy
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile
- .:/var/www/html
ports:
- "${DOCKER_WEB_PORT:-127.0.0.1:80}:80"
environment:
SERVER_NAME: "${SERVER_NAME:-:80}"
php-fpm:
image: "ghcr.io/opdavies/docker-drupal-example-php-fpm:${DOCKER_TAG:-latest}"
build:
context: .
volumes:
- .:/var/www/html
mysql:
image: mariadb:10
volumes:
- db-data:/var/lib/mysql
environment:
MYSQL_DATABASE: drupal
MYSQL_RANDOM_ROOT_PASSWORD: 'true'
MYSQL_PASSWORD: drupal
MYSQL_USER: drupal
volumes:
db-data: {}

29
run Executable file
View file

@ -0,0 +1,29 @@
#!/bin/bash
set -e
function cmd {
_dc php-fpm "${@}"
}
function composer {
cmd composer "${@}"
}
function drush {
cmd php vendor/bin/drush "${@}"
}
function help {
printf "%s <task> [args]\n\nTasks:\n" "${0}"
compgen -A function | grep -v "^_" | cat -n
printf "\nExtended help:\n Each task has comments for general usage\n"
}
function _dc {
docker-compose run --rm "${@}"
}
eval "${@:-help}"

View file

@ -0,0 +1,6 @@
xdebug.mode=develop,debug
xdebug.client_host=host.docker.internal
xdebug.discover_client_host=0
xdebug.output_dir=/tmp/xdebug
xdebug.log=/tmp/xdebug/xdebug-docker-drupal-example.log
xdebug.start_with_request=yes