#!/bin/bash
app_name=glaze
dockerid=$(docker ps -qf "ancestor=$app_name")
commit_sha=$(git rev-parse --short HEAD)
docker build --network=host . \
--file Dockerfile \
--build-arg build_hash=$commit_sha \
--tag $app_name:latest
if [ "$dockerid" != "" ]; then
docker stop $dockerid
fi;
docker run --restart unless-stopped -d \
--memory 1g --publish 8002:80 \
--mount type=bind,source=/var/lib/soft-serve,target=/app/soft-serve,readonly \
$app_name:latest
docker container prune -f