#!/usr/bin/env bash
# get docker image name from input
docker_image=$1
# remove local docker image
docker rmi $docker_image
# build new docker image
docker build .
# get the ID of new dangling image
docker_image_id=$(docker images -q --filter dangling=true)
# tag docker image
docker tag "$docker_image_id" "$docker_image"
# push docker image
docker push $docker_image