Skip to content

Commit c78de8c

Browse files
committed
Make docker-compose flexible
1 parent 04c0a73 commit c78de8c

2 files changed

Lines changed: 11 additions & 8 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ jobs:
2828
./services create || true
2929
- name: Run Script
3030
run: |
31-
./services start && ./services stop
31+
./services start test && ./services stop test

services

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
22
#
33
# Command Line Interface to start all services associated with the Getting-Started Tutorial
44
#
5-
# For this tutorial the commands are merely a convenience script to run docker-compose
6-
#
5+
# For this tutorial the commands are merely a convenience script to run ${dockerCmd}#
76

87
set -e
98

10-
if (( $# != 1 )); then
11-
echo "Illegal number of parameters"
9+
dockerCmd="docker compose"
10+
if (( $# == 2 )); then
11+
dockerCmd="docker-compose"
12+
fi
13+
14+
if (( $# < 1 )); then echo "Illegal number of parameters"
1215
echo "usage: services [create|start|stop]"
1316
exit 1
1417
fi
@@ -35,13 +38,13 @@ displayServices () {
3538
startContainers () {
3639
echo ""
3740
export IDM_HTTPS_ENABLED="$1"
38-
docker-compose up -d --remove-orphans
41+
${dockerCmd} up -d --remove-orphans
3942
echo ""
4043
}
4144

4245
stoppingContainers () {
4346
echo "Stopping running containers"
44-
docker-compose down -v --remove-orphans
47+
${dockerCmd} down -v --remove-orphans
4548
}
4649

4750
command="$1"
@@ -68,7 +71,7 @@ case "${command}" in
6871
export $(cat .env | grep "#" -v)
6972
echo "Pulling Docker images"
7073
docker pull curlimages/curl
71-
docker-compose pull
74+
${dockerCmd} pull
7275
;;
7376
*)
7477
echo "Command not Found."

0 commit comments

Comments
 (0)