18 lines
585 B
Plaintext
18 lines
585 B
Plaintext
|
#!/bin/bash
|
||
|
|
||
|
# assumes compose files for swarm are specified as docker-compose.stack.yml.
|
||
|
|
||
|
# identify the parent directory in order to name the service.
|
||
|
PARENT_DIR="${PWD##*/}"
|
||
|
# replace restricted characters.
|
||
|
PARENT_DIR=$( echo $PARENT_DIR | tr ' '. _ )
|
||
|
|
||
|
# attempt to find a suitable compose file.
|
||
|
if [ ! -f "docker-compose.stack.yml" ]; then
|
||
|
echo "No suitable stack compose file found in directory.";
|
||
|
exit 1;
|
||
|
fi
|
||
|
|
||
|
# if we found a compose file, deploy it.
|
||
|
echo "Deploying stack as ${PARENT_DIR}..."
|
||
|
docker stack deploy -c docker-compose.stack.yml --with-registry-auth ${PARENT_DIR}
|