Wordpress/tools/local-env/launch-containers.sh
Riad Benguella 42a8715471 Build/Test Tools: Add the e2e tests setup.
- Adds a local environment based on docker
 - Adds the e2e tests setup
 - Adds a "Hello World" e2e test to serve as a template

Props gziolo, herregroen, mcsf.
Fixes #45165.


git-svn-id: https://develop.svn.wordpress.org/trunk@45570 602fd350-edb4-49c9-b593-d223f7449a82
2019-06-27 11:26:58 +00:00

35 lines
1.1 KiB
Bash

#!/bin/bash
# Exit if any command fails.
set -e
# Common variables.
DOCKER_COMPOSE_FILE_OPTIONS="-f $(dirname "$0")/docker-compose.yml"
# Include useful functions.
. "$(dirname "$0")/includes.sh"
# Check that Docker is installed.
if ! command_exists "docker"; then
echo -e $(error_message "Docker doesn't seem to be installed. Please head on over to the Docker site to download it: $(action_format "https://www.docker.com/products/docker-desktop")")
exit 1
fi
# Check that Docker is running.
if ! docker info >/dev/null 2>&1; then
echo -e $(error_message "Docker isn't running. Please check that you've started your Docker app, and see it in your system tray.")
exit 1
fi
# Stop existing containers.
echo -e $(status_message "Stopping Docker containers...")
docker-compose $DOCKER_COMPOSE_FILE_OPTIONS down --remove-orphans >/dev/null
# Download image updates.
echo -e $(status_message "Downloading Docker image updates...")
docker-compose $DOCKER_COMPOSE_FILE_OPTIONS pull
# Launch the containers.
echo -e $(status_message "Starting Docker containers...")
docker-compose $DOCKER_COMPOSE_FILE_OPTIONS up -d >/dev/null