#!/bin/bash

# usage: `s/rebuild-docker`
# For use when rapidly changing the Dockerfile in development
# Stops and removes the container
# Removes the built image
# then use s/start-docker script to rebuild

# names the built image as below
app="rcpch-dgc-server"

# if the image exists then remove it before rebuild
if [ "$(docker images -q ${app} 2>/dev/null)" != "" ]; then
    docker container stop ${app} &&
        docker container rm ${app} &&
        docker image rm ${app}
fi

# build the image
docker build -t ${app} .
