Skip to content

Commit

Permalink
build: attempt to use {WORDPRESS,NODE}_CONTAINER_HOST
Browse files Browse the repository at this point in the history
  • Loading branch information
frugan-dev committed Jun 17, 2024
1 parent 11c3ae6 commit f9e1cda
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
Expand All @@ -47,5 +47,10 @@ jobs:
- name: Run Makefile tasks
run: |
make test MARIADB_TAG=$MARIADB_TAG WORDPRESS_TAG=$WORDPRESS_TAG NODE_TAG=$NODE_TAG
make test \
WORDPRESS_CONTAINER_HOST=wordpress \
NODE_CONTAINER_HOST=node \
MARIADB_TAG=$MARIADB_TAG \
WORDPRESS_TAG=$WORDPRESS_TAG \
NODE_TAG=$NODE_TAG
make down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,10 @@ GITHUB_TOKEN ?=
MODE ?= develop

WORDPRESS_CONTAINER_NAME=wordpress
WORDPRESS_CONTAINER_HOST ?= localhost
WORDPRESS_CONTAINER_USER=root
NODE_CONTAINER_NAME=node
NODE_CONTAINER_HOST ?= localhost
NODE_CONTAINER_USER=root
NODE_CONTAINER_BUILD_DIR=/app/build
TMP_DIR=tmp
Expand Down Expand Up @@ -124,8 +126,8 @@ set-env:

wait:
@echo "Waiting for services to be ready"
@$(TMP_DIR)/wait-for-it.sh 127.0.0.1:80 --timeout=300 --strict -- echo "WordPress is up"
@$(TMP_DIR)/wait-for-it.sh 127.0.0.1:$(NODE_PORT) --timeout=300 --strict -- echo "Node is up"
@$(TMP_DIR)/wait-for-it.sh $(WORDPRESS_CONTAINER_HOST):80 --timeout=300 --strict -- echo "WordPress is up"
@$(TMP_DIR)/wait-for-it.sh $(NODE_CONTAINER_HOST):$(NODE_PORT) --timeout=300 --strict -- echo "Node is up"

@echo "Waiting for WordPress to complete setup"
@$(DOCKER_COMPOSE) exec -u$(WORDPRESS_CONTAINER_USER) $(WORDPRESS_CONTAINER_NAME) sh -c 'timeout=300; while [ $$timeout -gt 0 ]; do [ -f $${WORDPRESS_CONF_FILE:-/bitnami/wordpress/wp-config.php} ] && break; echo "Waiting for wp-config.php..."; sleep 5; timeout=$$((timeout - 5)); done; [ $$timeout -gt 0 ]'
Expand Down

0 comments on commit f9e1cda

Please sign in to comment.