Skip to content

Commit 371f392

Browse files
committed
Make docker-compose flexible
1 parent f533564 commit 371f392

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
@@ -25,7 +28,7 @@ stoppingContainers () {
2528
echo -e "Force removal of \033[1mmqtt-subscriber\033[0m"
2629
(docker stop mqtt-subscriber &>/dev/null) || (echo -e "\033[1mmqtt-subscriber\033[0m not running")
2730
echo "Stopping running containers"
28-
docker-compose down -v --remove-orphans
31+
${dockerCmd} down -v --remove-orphans
2932
}
3033

3134
displayServices () {
@@ -110,7 +113,7 @@ case "${command}" in
110113
echo -e "- \033[1mTutorial\033[0m acts as a series of dummy IoT Sensors over MQTT"
111114
echo -e "- \033[1mMosquitto\033[0m acts as an MQTT Message Broker"
112115
echo ""
113-
docker-compose up -d --remove-orphans
116+
${dockerCmd} up -d --remove-orphans
114117
waitForMongo
115118
addDatabaseIndex
116119
waitForOrion
@@ -126,7 +129,7 @@ case "${command}" in
126129
export $(cat .env | grep "#" -v)
127130
echo "Pulling Docker images"
128131
docker pull curlimages/curl
129-
docker-compose pull
132+
${dockerCmd} pull
130133
;;
131134
*)
132135
echo "Command not Found."

0 commit comments

Comments
 (0)