
# script to prepare for debugging a service deployed to docker that keeps restarting.
# This usually means there is some error in the initialization of the service.
# Launching docker contnainer in the interactive mode and running the service_index.js will help with identifying the problem.

# edit docker file and replace entrypoint with
# ENTRYPOINT bash

# --- Can be any tag. test, debug, foo etc. are all valid as long as it's consistently used in this script ---
containertag=test

# --- service.docker file in this case connector. ---
dfile=connector.docker

# --- port for the service 4007 for connector ---
port=4007

# --- whereever the tmpdir for the deploy to docker container is setup to be. ---
tmpdir="/tmp/tmpdir"


cd $tmpdir
docker build -t $containertag -f $dfile .
docker run -it --name $containertag -h localhost -p $port $containertag

# if it comokains with error --- docker: Error response from daemon: Conflict. The container name "/test" is already in use by container "<container number>"
# run the following command
# docker rm <container number>

# you can run node sys_index_connetor.js or the corresponding appname_index.js to debug the startup issue
