kaspad/run-dev.sh
Svarog 67358d1e85 [NOD-95] Added docker file and scripts to run dev instances for debugging (#241)
* [NOD-95] Added docker file and scripts to run dev instances for debugging

* [NOD-95] Enabled debugging from dockers

* [NOD-95] Removed redundant entrypoint.sh file

* [NOD-95] Removed multi-stage build artifacts from Dockerfile.dev

* [NOD-95] Add --help to run-dev.sh
2019-04-03 12:46:00 +03:00

40 lines
979 B
Bash
Executable File

#!/bin/bash
# This is a short script that compiles the code inside a docker container, and runs two instances connected to each other
# docker defenition is in docker/Dockerfile.dev
# instances defenition is in docker/docker-compose.yml
set -e
if [[ $* == *--help* ]]
then
echo "Usage:"
echo -e "\t./run-def.sh [--rm] [--debug]"
echo ""
echo -e "\t--rm\t\tRemove dockers prior to running them, to clear data"
echo -e "\t--debug\t\tEnable debugging on second server. Server will not start until debugger is attached"
exit
fi
export SERVICE_NAME=btcd
export GIT_COMMIT=$(git rev-parse --short=12 HEAD)
docker build -t "${SERVICE_NAME}:${GIT_COMMIT}" . \
-f docker/Dockerfile.dev \
|| fatal 'Failed to build the docker image'
docker tag "${SERVICE_NAME}:${GIT_COMMIT}" "${SERVICE_NAME}:latest"
cd docker
if [[ $* == *--rm* ]]
then
docker-compose rm -f
fi
if [[ $* == *--debug* ]]
then
docker-compose up first second-debug
else
docker-compose up first second
fi