Commit b60e0add authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Initial commit for docker compose branch

This is a developer convenience branch containing a docker-compose
config and associated scripts and data files.

Usage: checkout in a worktree within the worktree you are currently
using and use with:

   export COMPOSE_DOCKER_CLI_BUILD=1
   export DOCKER_BUILDKIT=1
   docker-compose -f <checkout-path>/docker-compose.yaml -p wordpress
parents
Loading
Loading
Loading
Loading

docker-compose.yaml

0 → 100644
+65 −0
Original line number Diff line number Diff line
version: "3.7"
services:
  proxy:
    build:
      context: ..
      target: nginx
    ports:
    - "80:80"
    links:
    - upstream
    volumes:
    - static:/app/static
    - media:/app/media
  upstream:
    build:
      context: ..
      args:
        php_version: "7.4"
    links:
    - database
    depends_on:
    - database
    expose: ["9000"]
    environment:
      SITE_URL: http://localhost
      SITE_ADMIN_EMAIL: dom@kodo.org.uk
      DB_NAME: singing-chimes
      DB_USER: singing-chimes
      DB_PASS: 978t6r7ft2e1q3ew9f78gsyub
      DB_HOST: database:3306
      WP_CONFIGS: /etc/wordpress/wp-debug.php
      # PLUGINS: |
      #   wp-crontrol
    # secrets:
    # - source: s3
    #   target: /etc/wordpress/s3.conf
    #   mode: 0400
    volumes:
    - static:/app/static
    - media:/app/media
    - ./wait-for.sh:/bin/wait-for
    - ./fpm-debug.conf:/usr/local/etc/php-fpm.d/debug.conf
    # - ./php-debug.ini:/usr/local/etc/php/conf.d/debug.ini
    - ./wp-debug.php:/etc/wordpress/wp-debug.php
    entrypoint: [/bin/wait-for, /bin/entrypoint]
    command: [php-fpm]
  database:
    image: mysql/mysql-server
    expose: ["3306"]
    command:
    - --default-authentication-plugin=mysql_native_password
    environment:
    - MYSQL_DATABASE=singing-chimes
    - MYSQL_USER=singing-chimes
    - MYSQL_PASSWORD=978t6r7ft2e1q3ew9f78gsyub
    volumes:
    - /var/lib/mysql

volumes:
  static: {}
  media: {}

# secrets:
#   s3:
#     file: s3-secret.conf

fpm-debug.conf

0 → 100644
+2 −0
Original line number Diff line number Diff line
[www]
catch_workers_output = yes

php-debug.ini

0 → 100644
+2 −0
Original line number Diff line number Diff line
[PHP]
memory_limit = 256M

run

0 → 100755
+7 −0
Original line number Diff line number Diff line
#!/bin/sh
set -eu
cd `dirname $0`
export COMPOSE_PROJECT_NAME=wordpress
export COMPOSE_DOCKER_CLI_BUILD=1
export DOCKER_BUILDKIT=1
exec docker-compose up --build

wait-for.sh

0 → 100755
+11 −0
Original line number Diff line number Diff line
#!/bin/bash
set -eu

HOST=${DB_HOST%:*}
PORT=${DB_HOST##*:}

while :; do
	nc -w 1 -z $HOST $PORT &&
		exec "$@"
	sleep 1
done