Skip to content

Commit 1211c8d

Browse files
committed
Make docker-compose flexible
1 parent a3d603e commit 1211c8d

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

.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
@@ -23,7 +26,7 @@ loadData () {
2326

2427
stoppingContainers () {
2528
echo "Stopping running containers"
26-
docker-compose down -v --remove-orphans
29+
${dockerCmd} down -v --remove-orphans
2730
}
2831

2932
displayServices () {
@@ -107,7 +110,7 @@ case "${command}" in
107110
echo -e "- \033[1;36mIoT-Agent\033[0m is configured for the UltraLight Protocol"
108111
echo -e "- \033[1;30mTutorial\033[0m acts as a series of dummy IoT Sensors over HTTP"
109112
echo ""
110-
docker-compose up -d --remove-orphans
113+
${dockerCmd} up -d --remove-orphans
111114
waitForMongo
112115
addDatabaseIndex
113116
waitForOrion
@@ -123,7 +126,7 @@ case "${command}" in
123126
export $(cat .env | grep "#" -v)
124127
echo "Pulling Docker images"
125128
docker pull curlimages/curl
126-
docker-compose pull
129+
${dockerCmd} pull
127130
;;
128131
*)
129132
echo "Command not Found."

0 commit comments

Comments
 (0)