mirror of
https://github.com/dokku/dokku.git
synced 2025-12-28 16:06:40 +01:00
Fixed port redirection issues
This commit is contained in:
23
dokku
23
dokku
@@ -46,21 +46,20 @@ case "$1" in
|
||||
deploy)
|
||||
APP="$2"; IMAGE="$3"
|
||||
pluginhook pre-deploy $APP $IMAGE
|
||||
if [[ ! -f "$DOKKU_ROOT/$APP/PORT" ]]; then
|
||||
# First deploy
|
||||
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"
|
||||
else
|
||||
# Regular deploy
|
||||
|
||||
# kill the app when running
|
||||
if [[ -f "$DOKKU_ROOT/$APP/PORT" ]]; then
|
||||
oldid=$(< "$DOKKU_ROOT/$APP/CONTAINER")
|
||||
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
|
||||
|
||||
# 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
|
||||
;;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user