From 206f6fea46d4183552392fe5191c0c7eebb4acf2 Mon Sep 17 00:00:00 2001 From: Ian Jenkins Date: Tue, 15 Mar 2022 14:44:41 +0000 Subject: [PATCH] [SETUP] Make use of docker-compose profiles. Use [docker-compose profiles](https://docs.docker.com/compose/profiles/) for starting up additional services such as blackfire for profiling and backstop for visual-regression testing. Unfortunately due us needing to extend nginx we can't use this for styleguide due to the following not being support in v3 of docker-compose: https://docs.docker.com/compose/extends/#extending-services well we probably still could but we'd need to bring up with the mutliple docker-compose files as well so little point just yet. https://docs.docker.com/compose/extends/#extending-services --- bin/docker/backstop | 2 +- bin/docker/disable_blackfire | 2 +- bin/docker/enable_blackfire | 2 +- bin/docker/setup_backstop | 6 +++--- docker-compose-blackfire.yml | 17 ----------------- docker-compose.yml | 13 +++++++++++++ 6 files changed, 19 insertions(+), 23 deletions(-) delete mode 100644 docker-compose-blackfire.yml diff --git a/bin/docker/backstop b/bin/docker/backstop index da84ef8f..59395594 100755 --- a/bin/docker/backstop +++ b/bin/docker/backstop @@ -1,3 +1,3 @@ #!/usr/bin/env bash -docker-compose -f docker-compose.yml run --rm --workdir /src backstop node ./bin/backstop.js "$@" +docker-compose --profile visual-regression run --rm --workdir /src backstop node ./bin/backstop.js "$@" diff --git a/bin/docker/disable_blackfire b/bin/docker/disable_blackfire index f244f885..67f1ef04 100755 --- a/bin/docker/disable_blackfire +++ b/bin/docker/disable_blackfire @@ -1,3 +1,3 @@ #!/usr/bin/env bash -docker-compose -f docker-compose.yml -f docker-compose-blackfire.yml stop && docker-compose up -d --remove-orphans +docker-compose --profile profiling stop && docker-compose up -d --remove-orphans diff --git a/bin/docker/enable_blackfire b/bin/docker/enable_blackfire index 1a03f38f..1aa1ec9c 100755 --- a/bin/docker/enable_blackfire +++ b/bin/docker/enable_blackfire @@ -1,3 +1,3 @@ #!/usr/bin/env bash -docker-compose stop && docker-compose -f docker-compose.yml -f docker-compose-blackfire.yml up -d +docker-compose stop && docker-compose --profile profiling up -d diff --git a/bin/docker/setup_backstop b/bin/docker/setup_backstop index a8e9def8..601fd24c 100755 --- a/bin/docker/setup_backstop +++ b/bin/docker/setup_backstop @@ -2,7 +2,7 @@ ENVIRONMENT="${@:-local}" -docker-compose -f docker-compose.yml run --rm --workdir /src backstop cp config/${ENVIRONMENT}/cookies.json.dist config/${ENVIRONMENT}/cookies.json; -docker-compose -f docker-compose.yml run --rm --workdir /src backstop cp config/${ENVIRONMENT}/secrets.json.dist config/${ENVIRONMENT}/secrets.json; +docker-compose --profile visual-regression run --rm --workdir /src backstop cp config/${ENVIRONMENT}/cookies.json.dist config/${ENVIRONMENT}/cookies.json; +docker-compose --profile visual-regression run --rm --workdir /src backstop cp config/${ENVIRONMENT}/secrets.json.dist config/${ENVIRONMENT}/secrets.json; -docker-compose -f docker-compose.yml run --rm --workdir /src backstop npm install; +docker-compose --profile visual-regression run --rm --workdir /src backstop npm install; diff --git a/docker-compose-blackfire.yml b/docker-compose-blackfire.yml deleted file mode 100644 index ef41be45..00000000 --- a/docker-compose-blackfire.yml +++ /dev/null @@ -1,17 +0,0 @@ -version: '3.9' - -services: - - blackfire: - build: - context: docker/blackfire - dockerfile: Dockerfile - env_file: - - docker/blackfire/.env - ports: - - '127.0.0.1:8707:8707' - -networks: - default: - external: true - name: ${DOCKER_NETWORK_NAME:-boxuk-docker} diff --git a/docker-compose.yml b/docker-compose.yml index e0e8d0e1..59204d8c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -98,6 +98,19 @@ services: - vr_node_modules:/src/app/node_modules:delegated extra_hosts: - '${LOOPBACK_HOST_NAME}:192.168.35.10' # IP should match the IP address set for nginx above + profiles: + - visual-regression + + blackfire: + build: + context: docker/blackfire + dockerfile: Dockerfile + env_file: + - docker/blackfire/.env + ports: + - '127.0.0.1:8707:8707' + profiles: + - profiling volumes: vr_yarn_cache: