Skip to content

Commit

Permalink
(+) variables in run.sh for container name and image tag
Browse files Browse the repository at this point in the history
  • Loading branch information
Mazettt committed Jul 21, 2023
1 parent 9607851 commit 4e43f98
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions run.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
#!/bin/bash

imageTag=mazettt:bitly
containerName=mazettt-bitly

if [[ $1 == "-h" ]]; then
echo "Use -b if you want to build the image before starting the app"
echo "Use -rm if you want to remove the running container"
exit 0
fi

if [[ $1 == "-rm" ]]; then
docker stop mazettt-bitly
docker rm mazettt-bitly
docker stop $containerName
docker rm $containerName
fi

if [[ $1 == "-b" ]]; then
docker build -t mazettt:bitly .
docker build -t $imageTag .
fi

docker run --name="mazettt-bitly" --restart=always -d -p 3012:3012 mazettt:bitly
docker run --name="$containerName" --restart=always -d -p 3012:3012 $imageTag

0 comments on commit 4e43f98

Please sign in to comment.