Merge pull request #279 from alhafoudh/master
Fixed port redirection issues
This commit is contained in:
commit
407c5b2875
1 file changed
+11
-12
@@ -46,21 +46,20 @@ case "$1" in
|
|||||||
deploy)
|
deploy)
|
||||||
APP="$2"; IMAGE="$3"
|
APP="$2"; IMAGE="$3"
|
||||||
pluginhook pre-deploy $APP $IMAGE
|
pluginhook pre-deploy $APP $IMAGE
|
||||||
if [[ ! -f "$DOKKU_ROOT/$APP/PORT" ]]; then
|
|
||||||
# First deploy
|
# kill the app when running
|
||||||
id=$(docker run -d -p 5000 -e PORT=5000 $IMAGE /bin/bash -c "/start web")
|
if [[ -f "$DOKKU_ROOT/$APP/PORT" ]]; then
|
||||||
echo $id > "$DOKKU_ROOT/$APP/CONTAINER"
|
|
||||||
port=$(docker port $id 5000 | sed 's/0.0.0.0://')
|
|
||||||
echo $port > "$DOKKU_ROOT/$APP/PORT"
|
|
||||||
echo "http://$(< "$DOKKU_ROOT/HOSTNAME"):$port" > "$DOKKU_ROOT/$APP/URL"
|
|
||||||
else
|
|
||||||
# Regular deploy
|
|
||||||
oldid=$(< "$DOKKU_ROOT/$APP/CONTAINER")
|
oldid=$(< "$DOKKU_ROOT/$APP/CONTAINER")
|
||||||
docker kill $oldid > /dev/null
|
docker kill $oldid > /dev/null
|
||||||
port=$(< "$DOKKU_ROOT/$APP/PORT")
|
|
||||||
id=$(docker run -d -p ":$port" -e "PORT=$port" $IMAGE /bin/bash -c "/start web")
|
|
||||||
echo $id > "$DOKKU_ROOT/$APP/CONTAINER"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# start the app
|
||||||
|
id=$(docker run -d -p 5000 -e PORT=5000 $IMAGE /bin/bash -c "/start web")
|
||||||
|
echo $id > "$DOKKU_ROOT/$APP/CONTAINER"
|
||||||
|
port=$(docker port $id 5000 | sed 's/0.0.0.0://')
|
||||||
|
echo $port > "$DOKKU_ROOT/$APP/PORT"
|
||||||
|
echo "http://$(< "$DOKKU_ROOT/HOSTNAME"):$port" > "$DOKKU_ROOT/$APP/URL"
|
||||||
|
|
||||||
pluginhook post-deploy $APP $port
|
pluginhook post-deploy $APP $port
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user