Files
mozo-backend/faye/rebuild-docker.sh
T
2020-02-29 11:43:00 -05:00

27 lines
999 B
Bash
Executable File

#!/usr/bin/env bash
# This script rebuilds the whole environment and starts a new container
# 1. ensure this script is run from the project's root, not the faye directory
pwd_dirname=$(basename $(pwd));
script_dirname="faye";
if [ "$pwd_dirname" == "$script_dirname" ]; then
echo "PWD DIRNAME: "$pwd_dirname;
echo "You must run this script from the project's root dir (../) for the Dockerfile to have access to the configs to COPY";
exit 1;
fi
# 2. stop and remove all running/existing containers
docker rm $(docker stop $(docker ps -a -q --filter ancestor=mozo_faye))
# 3. remove the previously built images
docker rmi mozo_faye
# 4. rebuild a fresh image from the latest code
docker build -f faye/Dockerfile -t mozo_faye .
# debug docker and enter the bash:
# docker run --network=host --env DRB_ENV=production -t -i --rm mozo_faye bash
# 5. Spin up the counter container from the generated image
docker run --network=host --env DRB_ENV=production --detach --name=mozo_faye mozo_faye