This repository has been archived on 2022-10-07. You can view files and clone it, but cannot push or open issues or pull requests.
skynet-webportal/dc

61 lines
2.0 KiB
Plaintext
Raw Permalink Normal View History

#!/bin/bash
# The dc command is an alias to docker-compose which also scans the current portal configuration (as defined in .env)
# and selects the right docker-compose files to include in the operation. You can use the command in the same way you
# would use docker-compose with the only difference being that you don't need to specify compose files. For more
# information you can run `./dc` or `./dc help`.
if [ -f .env ]; then
OLD_IFS=$IFS
IFS=$'\n'
for x in $(grep -v '^#.*' .env); do export $x; done
IFS=$OLD_IFS
fi
2021-05-28 15:55:15 +00:00
# include base docker compose file
COMPOSE_FILES="-f docker-compose.yml"
for i in $(seq 1 ${#PORTAL_MODULES}); do
# accounts module - alias "a"
if [[ ${PORTAL_MODULES:i-1:1} == "a" ]]; then
2021-10-07 09:43:09 +00:00
COMPOSE_FILES+=" -f docker-compose.mongodb.yml -f docker-compose.accounts.yml"
fi
2021-12-01 10:02:55 +00:00
# blocker module - alias "b"
if [[ ${PORTAL_MODULES:i-1:1} == "b" ]]; then
COMPOSE_FILES+=" -f docker-compose.mongodb.yml -f docker-compose.blocker.yml"
2021-12-01 10:02:55 +00:00
fi
# jaeger module - alias "j"
if [[ ${PORTAL_MODULES:i-1:1} == "j" ]]; then
COMPOSE_FILES+=" -f docker-compose.jaeger.yml"
fi
2021-10-07 09:43:09 +00:00
2021-11-09 17:04:05 +00:00
# malware-scanner module - alias "s"
if [[ ${PORTAL_MODULES:i-1:1} == "s" ]]; then
COMPOSE_FILES+=" -f docker-compose.blocker.yml -f docker-compose.mongodb.yml -f docker-compose.malware-scanner.yml"
2021-11-09 17:04:05 +00:00
fi
# mongodb module - alias "m"
2021-10-07 09:43:09 +00:00
if [[ ${PORTAL_MODULES:i-1:1} == "m" ]]; then
COMPOSE_FILES+=" -f docker-compose.mongodb.yml"
fi
2021-12-20 12:15:28 +00:00
2022-02-24 12:16:30 +00:00
# abuse-scanner module - alias "u"
2021-12-20 12:15:28 +00:00
if [[ ${PORTAL_MODULES:i-1:1} == "u" ]]; then
2022-02-24 12:16:30 +00:00
COMPOSE_FILES+=" -f docker-compose.mongodb.yml -f docker-compose.blocker.yml -f docker-compose.abuse-scanner.yml"
2021-12-20 12:15:28 +00:00
fi
2022-05-10 15:13:50 +00:00
# pinner module - alias "p"
if [[ ${PORTAL_MODULES:i-1:1} == "p" ]]; then
COMPOSE_FILES+=" -f docker-compose.mongodb.yml -f docker-compose.pinner.yml"
fi
done
# override file if exists
if [[ -f docker-compose.override.yml ]]; then
COMPOSE_FILES+=" -f docker-compose.override.yml"
fi
docker-compose $COMPOSE_FILES $@