neko/.docker/rebuild-server
Miroslav Šedivý 0cebe465a2 fix build.
2023-03-17 20:47:53 +01:00

26 lines
675 B
Bash
Executable File

#!/bin/bash
if [ -f ".env.default" ]
then
export $(cat .env.default | sed 's/#.*//g' | xargs)
fi
if [ -f ".env" ]
then
export $(cat .env | sed 's/#.*//g' | xargs)
fi
# use -f to force rebuild
if [ "$(docker images -q neko_dev_server 2> /dev/null)" == "" ] || [ "$1" == "-f" ]; then
docker build -t neko_dev_server -f base/Dockerfile --target server ../
fi
docker run --rm -it \
-v "${PWD}/../server:/src" \
-e GIT_COMMIT=`git rev-parse --short HEAD` \
-e GIT_BRANCH=`git rev-parse --symbolic-full-name --abbrev-ref HEAD` \
-e GIT_DIRTY=`git diff-index --quiet HEAD -- || echo "✗-"` \
--entrypoint="bash" \
--workdir="/src" \
neko_dev_server ./build