Skip to content

Commit 1db53c4

Browse files
committed
Make docker-compose flexible
1 parent 7a03a5d commit 1db53c4

2 files changed

Lines changed: 14 additions & 11 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: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,32 @@
22
#
33
# Command Line Interface to start all services associated with the Fast/Micro-RTPS tutorials
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

109
stoppingContainers () {
1110
echo "Stopping running containers"
12-
docker-compose -f docker-compose/kurento-with-filters.yml down -v --remove-orphans
11+
${dockerCmd} -f docker-compose/kurento-with-filters.yml down -v --remove-orphans
1312
}
1413
startingContainers () {
1514
echo -e "Starting containers: - \033[1;35mKurento\033[0m and \033[1mKurento-Examples (${command})\033[0m"
1615
echo -e "- \033[1;35mKurento\033[0m is a Media Server"
1716
echo -e "- \033[1mKurento-Examples\033[0m displays a web app to access the web-cam"
1817
echo ""
19-
TUTORIAL_NAME=${command} docker-compose -f docker-compose/kurento-with-filters.yml up -d --remove-orphans
18+
TUTORIAL_NAME=${command} ${dockerCmd} -f docker-compose/kurento-with-filters.yml up -d --remove-orphans
2019
echo ""
2120
echo -e "Now open \033[4mhttps://localhost:8443\033[0m"
2221
}
2322

2423

2524

26-
if (( $# != 1 )); then
27-
echo "Illegal number of parameters"
25+
dockerCmd="docker compose"
26+
if (( $# == 2 )); then
27+
dockerCmd="docker-compose"
28+
fi
29+
30+
if (( $# < 1 )); then echo "Illegal number of parameters"
2831
echo "usage: services [start|stop|create]"
2932
exit 1
3033
fi
@@ -41,7 +44,7 @@ case "${command}" in
4144
echo -e "- \033[1;35mKurento\033[0m is a Media Server"
4245
echo -e "- \033[1mKurento-Examples\033[0m displays a web app to access the web-cam"
4346
echo ""
44-
docker-compose -f docker-compose/kurento.yml up -d --remove-orphans
47+
${dockerCmd} -f docker-compose/kurento.yml up -d --remove-orphans
4548
echo ""
4649
echo -e "Now open \033[4mhttps://localhost:8443\033[0m"
4750
;;
@@ -56,7 +59,7 @@ case "${command}" in
5659
"hello-world")
5760
stoppingContainers;
5861
echo -e "Starting containers: - \033[1;35mKurento\033[0m and \033[1mKurento-Examples (hello-world)\033[0m"
59-
docker-compose -f docker-compose/kurento.yml up -d --remove-orphans
62+
${dockerCmd} -f docker-compose/kurento.yml up -d --remove-orphans
6063
echo ""
6164
echo -e "Now open \033[4mhttps://localhost:8443\033[0m"
6265
;;
@@ -92,7 +95,7 @@ case "${command}" in
9295
export $(cat .env | grep "#" -v)
9396
echo "Pulling Docker images"
9497
docker pull curlimages/curl
95-
docker-compose -f docker-compose/kurento.yml pull
96-
docker-compose -f docker-compose/kurento-with-filters.yml pull
98+
${dockerCmd} -f docker-compose/kurento.yml pull
99+
${dockerCmd} -f docker-compose/kurento-with-filters.yml pull
97100
;;
98101
esac

0 commit comments

Comments
 (0)