#!/usr/bin/env bash
set -e
set -x

#build
docker build --rm -f Dockerfile -t apidocjs:latest .

#test
echo node version: "$(docker run --rm --entrypoint=node apidocjs --version)"
# shellcheck disable=SC2046
[ -z "$(docker run --rm -u$(id -ru) -v ${PWD}/test:/src apidocjs --silent | grep "not found in block")" ]
ls -l test/build/docs/index.html

##cleanup after test
rm -r test/build

#save
docker tag apidocjs:latest dkregistry.xai-corp.net:5000/xaicorp/apidocjs:latest
docker push dkregistry.xai-corp.net:5000/xaicorp/apidocjs:latest
