Files
alfresco-community-repo/packaging/tests/scripts/start-compose.sh
evasques 309f6baae3 ACS-4653 Migrate to GHA on release/7.2.1 (#1758)
* Remove travis configuration files
* Added property dependency.alfresco-transform-core.version
* Added github action configuration for 7.2.1
* Add missing scripts and adjust start-compose.sh
* Give execution permissions to scripts

* ACS-3841 Add missing logs for WebDAV TAS tests (#1629)
* ACS-3841 Add missing logs
* ACS-3841 Reformat code + fix grep

(cherry picked from commit cdbe3292e0)

* Move ags ci getLogs script. Update badge on readme
2023-02-22 15:30:43 +00:00

51 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
set -x
export DOCKER_COMPOSE_PATH=$1
export DOCKER_COMPOSES=""
export CLEAN_UP=""
for var in "$@"
do
if [ "$var" == "no-clean-up" ]
then
export CLEAN_UP="$var"
else
export DOCKER_COMPOSES+="--file $var "
fi
done
if [ -z "$DOCKER_COMPOSES" ]
then
echo "Please provide path to docker-compose.yml: \"${0##*/} /path/to/docker-compose.yml\""
exit 1
fi
# Cleans up any generated images. These are created if the docker-compose file has "build:" clauses. They are not
# recreated if an image with the same name already exist. Also cleans up existing containers. Generally only needed on
# dev systems, however...
# The second parameter can be used to avoid doing a clean up if we are doing a restart test.
if [ "$CLEAN_UP" != "no-clean-up" ]
then
docker-compose ${DOCKER_COMPOSES} --project-directory $(dirname "${DOCKER_COMPOSE_PATH}") kill
docker-compose ${DOCKER_COMPOSES} --project-directory $(dirname "${DOCKER_COMPOSE_PATH}") rm -f
export GENERATED_IMAGES=$(docker images | grep '^environment_' | awk '{ print $3 }')
if [ -n "$GENERATED_IMAGES" ]
then
docker image rm -f $GENERATED_IMAGES
fi
fi
echo "Starting ACS stack in ${DOCKER_COMPOSE_PATH}"
# .env files are picked up from project directory correctly on docker-compose 1.23.0+
docker-compose ${DOCKER_COMPOSES} --project-directory $(dirname "${DOCKER_COMPOSE_PATH}") up -d
if [ $? -eq 0 ]
then
echo "Docker Compose started ok"
else
echo "Docker Compose failed to start" >&2
exit 1
fi