Create a docker-compose.testing.common.yml file to share configuration.

This commit is contained in:
paul121 2021-08-16 15:09:27 -07:00 committed by Michael Stenta
parent 24cbf38a18
commit 9cd609e169
5 changed files with 39 additions and 47 deletions

View File

@ -49,11 +49,15 @@ jobs:
# farmOS Composer project 2.x branch is always used.
- name: Build farmOS 2.x-dev Docker image
run: docker build --build-arg FARMOS_REPO=https://github.com/${FARMOS_REPO} --build-arg FARMOS_VERSION=${FARMOS_VERSION} --build-arg WWW_DATA_ID=33 -t farmos/farmos:2.x-dev docker/dev
# Build a new docker-compose.yml file from docker-compose.testing.common + docker-compose.testing.{dbms}.yml.
# Copy to the current directory so that farmOS volume mounts don't change to the docker/www folder.
- name: Create docker-compose.yml
run: cp docker/docker-compose.testing.${{ matrix.dbms }}.yml docker-compose.yml
- name: Start containers
env:
DB_URL: ${{ matrix.DB_URL }}
run: |
cp docker/docker-compose.testing.* .
docker-compose -f docker-compose.testing.common.yml -f docker-compose.testing.${{ matrix.dbms }}.yml config > docker-compose.yml
- name: Start containers
run: docker-compose up -d
- name: Wait until test-runner container is ready
# The test-runner-container-fs-ready file is only created once we expect the containers to be online

View File

@ -0,0 +1,29 @@
version: '3'
services:
www:
image: farmos/farmos:2.x-dev
volumes:
- './www:/opt/drupal'
environment:
FARMOS_FS_READY_SENTINEL_FILENAME: /opt/drupal/www-container-fs-ready
test-runner:
depends_on:
- www
image: farmos/farmos:2.x
entrypoint: /bin/bash
command:
- -c
- |
set -e
# Wait until the dev farmOS container has finished copying its files
until [ -f /opt/drupal/www-container-fs-ready ]; do sleep 0.1; done
# Run normal entrypoint and apache - only at this point is the test-runner-container-fs-ready
# file created, allowing the Github action to also wait for the above conditions on the basis
# of that file's creation.
exec docker-entrypoint.sh apache2-foreground
volumes:
- './www:/opt/drupal'
environment:
FARMOS_FS_READY_SENTINEL_FILENAME: /opt/drupal/test-runner-container-fs-ready
SIMPLETEST_DB: $DB_URL

View File

@ -1,3 +1,4 @@
# Inherits from docker-compose.testing.common.yml
version: '3'
services:
db:
@ -15,31 +16,17 @@ services:
www:
depends_on:
- db
image: farmos/farmos:2.x-dev
volumes:
- './www:/opt/drupal'
environment:
FARMOS_FS_READY_SENTINEL_FILENAME: /opt/drupal/www-container-fs-ready
test-runner:
depends_on:
- www
image: farmos/farmos:2.x
entrypoint: /bin/bash
command:
- -c
- |
set -e
# Wait until the dev farmOS container has finished copying its files
until [ -f /opt/drupal/www-container-fs-ready ]; do sleep 0.1; done
# Wait until Postgres is online listening to its socket
# Wait until mariadb is online listening to its socket
while { ! exec 3<>/dev/tcp/db/3306; } > /dev/null 2>&1; do sleep 0.1; done
# Run normal entrypoint and apache - only at this point is the test-runner-container-fs-ready
# file created, allowing the Github action to also wait for the above conditions on the basis
# of that file's creation.
exec docker-entrypoint.sh apache2-foreground
volumes:
- './www:/opt/drupal'
environment:
FARMOS_FS_READY_SENTINEL_FILENAME: /opt/drupal/test-runner-container-fs-ready
SIMPLETEST_DB: $DB_URL

View File

@ -1,3 +1,4 @@
# Inherits from docker-compose.testing.common.yml
version: '3'
services:
db:
@ -14,17 +15,8 @@ services:
www:
depends_on:
- db
image: farmos/farmos:2.x-dev
volumes:
- './www:/opt/drupal'
environment:
FARMOS_FS_READY_SENTINEL_FILENAME: /opt/drupal/www-container-fs-ready
test-runner:
depends_on:
- www
image: farmos/farmos:2.x
entrypoint: /bin/bash
command:
- -c
- |
@ -37,8 +29,3 @@ services:
# file created, allowing the Github action to also wait for the above conditions on the basis
# of that file's creation.
exec docker-entrypoint.sh apache2-foreground
volumes:
- './www:/opt/drupal'
environment:
FARMOS_FS_READY_SENTINEL_FILENAME: /opt/drupal/test-runner-container-fs-ready
SIMPLETEST_DB: $DB_URL

View File

@ -1,17 +1,7 @@
# Inherits from docker-compose.testing.common.yml
version: '3'
services:
www:
image: farmos/farmos:2.x-dev
volumes:
- './www:/opt/drupal'
environment:
FARMOS_FS_READY_SENTINEL_FILENAME: /opt/drupal/www-container-fs-ready
test-runner:
depends_on:
- www
image: farmos/farmos:2.x
entrypoint: /bin/bash
command:
- -c
- |
@ -22,8 +12,3 @@ services:
# file created, allowing the Github action to also wait for the above conditions on the basis
# of that file's creation.
exec docker-entrypoint.sh apache2-foreground
volumes:
- './www:/opt/drupal'
environment:
FARMOS_FS_READY_SENTINEL_FILENAME: /opt/drupal/test-runner-container-fs-ready
SIMPLETEST_DB: $DB_URL