-
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.
build: use Docker for local development
- Loading branch information
Showing
12 changed files
with
355 additions
and
36 deletions.
There are no files selected for viewing
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,7 @@ | ||
/.dependabot/ | ||
/.github/ | ||
/.git/ | ||
/.platform/ | ||
/Makefile | ||
/README.md | ||
/**/node_modules/ |
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 |
---|---|---|
@@ -1,32 +1,10 @@ | ||
# | ||
# Copy and rename this file to .env at root of this project. | ||
# | ||
MYSQL_DATABASE=phpsouthwales | ||
MYSQL_HOSTNAME=mysql | ||
MYSQL_PASSWORD=secret | ||
MYSQL_PORT=3306 | ||
MYSQL_USER=phpsouthwales | ||
|
||
# A common use case is to supply database creds via the environment. Edit settings.php | ||
# like so: | ||
# | ||
# $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'), | ||
# ]; | ||
# | ||
# Uncomment and populate as needed. | ||
# MYSQL_DATABASE= | ||
# MYSQL_HOSTNAME= | ||
# MYSQL_PASSWORD= | ||
# MYSQL_PORT= | ||
# MYSQL_USER= | ||
|
||
# Another common use case is to set Drush's --uri via environment. | ||
# DRUSH_OPTIONS_URI=http://example.com | ||
|
||
DRUPAL_SALT= | ||
DRUPAL_SALT=abc123 | ||
|
||
MEETUP_EVENT_STATUSES=upcoming | ||
MEETUP_GROUP_URL_NAME=php-south-wales |
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 |
---|---|---|
@@ -1,14 +1,17 @@ | ||
* | ||
!*/ | ||
/bin/ | ||
/vendor | ||
!/.docker.env.example | ||
!/.dockerignore | ||
!/.github/** | ||
!/bin/* | ||
!/config/* | ||
!/docker-compose.yaml | ||
!/run | ||
!/tools/** | ||
!/web/modules/custom | ||
!/tools/docker/** | ||
!/web/modules/custom/** | ||
!/web/sites/default/settings.php | ||
!/web/sites/default/settings.platformsh.php | ||
!/web/themes/custom | ||
/bin/ | ||
/vendor/ |
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,49 @@ | ||
x-app: &default-app | ||
env_file: | ||
- .docker.env | ||
|
||
services: | ||
proxy: | ||
image: nginxproxy/nginx-proxy | ||
volumes: | ||
- /var/run/docker.sock:/tmp/docker.sock | ||
ports: | ||
- "${DOCKER_WEB_PORT_FORWARD:-127.0.0.1:80}:80" | ||
|
||
nginx: | ||
<<: *default-app | ||
build: | ||
dockerfile: tools/docker/Dockerfile | ||
context: . | ||
target: nginx | ||
volumes: | ||
- ./:/app | ||
depends_on: | ||
- php | ||
environment: | ||
VIRTUAL_HOST: phpsouthwales.localhost | ||
|
||
php: | ||
<<: *default-app | ||
build: | ||
dockerfile: tools/docker/Dockerfile | ||
context: . | ||
target: dev | ||
volumes: | ||
- ./:/app | ||
depends_on: | ||
mysql: | ||
condition: service_healthy | ||
|
||
mysql: | ||
<<: *default-app | ||
image: mariadb:10 | ||
volumes: | ||
- ./tools/assets/development:/docker-entrypoint-initdb.d | ||
- db-data:/var/lib/mysql | ||
healthcheck: | ||
test: ["CMD-SHELL", "bash", "-c", "echo > /dev/tcp/localhost/3306"] | ||
interval: 1s | ||
|
||
volumes: | ||
db-data: {} |
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,60 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
TTY="" | ||
if [[ ! -t 1 ]]; then | ||
TTY="-T" | ||
fi | ||
|
||
DC="${DC:-exec}" | ||
|
||
function sh { | ||
cmd sh "${@}" | ||
} | ||
|
||
function cmd { | ||
# Run any command in the php container. | ||
_dc php "${@}" | ||
} | ||
|
||
function composer { | ||
# Execute Composer commands. | ||
. .docker.env | ||
|
||
_dc -e COMPOSER_MEMORY_LIMIT=${COMPOSER_MEMORY_LIMIT} php composer "${@}" | ||
} | ||
|
||
function drupal:install { | ||
# Install Drupal and pull in the latest event data. | ||
drush site:install -y --account-pass admin123 --existing-config | ||
drush migrate:import --all | ||
drush cache:rebuild | ||
drush core:cron | ||
drush advancedqueue:queue:process event_pull | ||
} | ||
|
||
function drupal:refresh { | ||
# Drop the current database and start again from scratch. | ||
drush sql:drop -y | ||
drupal:install | ||
} | ||
|
||
function drush { | ||
# Execute Drush commands. | ||
cmd 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 ${DC} ${TTY} "${@}" | ||
} | ||
|
||
eval "${@:-help}" |
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,28 @@ | ||
ARG NGINX_VERSION=1 | ||
ARG PHP_VERSION=7.4 | ||
|
||
FROM php:${PHP_VERSION}-fpm-alpine AS base | ||
ENV PATH=$PATH:/app/bin | ||
WORKDIR /app | ||
RUN apk add --no-cache \ | ||
libpng-dev \ | ||
mariadb-client \ | ||
&& docker-php-ext-install \ | ||
bcmath \ | ||
gd \ | ||
pdo_mysql | ||
|
||
FROM base AS dev | ||
RUN apk add --no-cache \ | ||
git \ | ||
unzip | ||
COPY --from=composer:1 /usr/bin/composer /usr/bin/composer | ||
WORKDIR /app | ||
#COPY composer.* ./ | ||
#RUN composer validate --strict | ||
#RUN composer install | ||
#COPY . . | ||
|
||
FROM nginx:${NGINX_VERSION}-alpine AS nginx | ||
WORKDIR /app | ||
COPY tools/docker/images/nginx/root / |
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,19 @@ | ||
server { | ||
server_name _; | ||
root /app/web; | ||
|
||
location / { | ||
try_files $uri /index.php?$query_string; | ||
} | ||
|
||
location ~ \.php(/|$) { | ||
fastcgi_split_path_info ^(.+?\.php)(|/.*)$; | ||
try_files $fastcgi_script_name =404; | ||
include fastcgi_params; | ||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
fastcgi_param PATH_INFO $fastcgi_path_info; | ||
fastcgi_param QUERY_STRING $query_string; | ||
fastcgi_intercept_errors on; | ||
fastcgi_pass php:9000; | ||
} | ||
} |
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 @@ | ||
date.timezone=UTC | ||
expose_php=Off |
Oops, something went wrong.