Merge pull request #1009 from progrium/993_mh-inspect-port-always
extract first port from Dockerfile and set config variable for use in deploy phase. closes #993
This commit is contained in:
commit
3caec44eac
4 files changed
+17
-3
No files matched your search
@@ -75,10 +75,12 @@ case "$1" in
|
|||||||
DOCKER_ARGS+=$(: | pluginhook docker-args-deploy $APP)
|
DOCKER_ARGS+=$(: | pluginhook docker-args-deploy $APP)
|
||||||
BIND_EXTERNAL=$(pluginhook bind-external-ip $APP)
|
BIND_EXTERNAL=$(pluginhook bind-external-ip $APP)
|
||||||
|
|
||||||
is_image_buildstep_based "$IMAGE" && START_CMD="/start web"
|
is_image_buildstep_based "$IMAGE" && DOKKU_BUILDSTEP=true
|
||||||
|
[[ -n "$DOKKU_BUILDSTEP" ]] && START_CMD="/start web"
|
||||||
|
[[ -z "$DOKKU_BUILDSTEP" ]] && eval "$(grep DOKKU_DOCKERFILE_PORT $DOKKU_ROOT/$APP/ENV)"
|
||||||
|
|
||||||
if [[ "$BIND_EXTERNAL" = "false" ]];then
|
if [[ "$BIND_EXTERNAL" = "false" ]];then
|
||||||
port=5000
|
port=${DOKKU_DOCKERFILE_PORT:=5000}
|
||||||
id=$(docker run -d -e PORT=$port $DOCKER_ARGS $IMAGE $START_CMD)
|
id=$(docker run -d -e PORT=$port $DOCKER_ARGS $IMAGE $START_CMD)
|
||||||
ipaddr=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' $id)
|
ipaddr=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' $id)
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -34,6 +34,10 @@ case "$1" in
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
dockerfile)
|
dockerfile)
|
||||||
|
# extract first port from Dockerfile
|
||||||
|
DOCKERFILE_PORT=$(grep EXPOSE Dockerfile | head -1 | awk '{ print $2 }')
|
||||||
|
[[ -n "$DOCKERFILE_PORT" ]] && dokku config:set-norestart $APP DOKKU_DOCKERFILE_PORT=$DOCKERFILE_PORT
|
||||||
|
|
||||||
# sticking with same pattern of building app image before pre-build for now.
|
# sticking with same pattern of building app image before pre-build for now.
|
||||||
docker build -t "$IMAGE" .
|
docker build -t "$IMAGE" .
|
||||||
# buildstep pluginhooks don't necessarily make sense for dockerfiles. call the new breed!!!
|
# buildstep pluginhooks don't necessarily make sense for dockerfiles. call the new breed!!!
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ FROM ubuntu:trusty
|
|||||||
ENV LC_ALL C
|
ENV LC_ALL C
|
||||||
ENV DEBIAN_FRONTEND noninteractive
|
ENV DEBIAN_FRONTEND noninteractive
|
||||||
ENV DEBCONF_NONINTERACTIVE_SEEN true
|
ENV DEBCONF_NONINTERACTIVE_SEEN true
|
||||||
EXPOSE 5000
|
EXPOSE 3000
|
||||||
|
|
||||||
RUN apt-get install -y software-properties-common && add-apt-repository ppa:chris-lea/node.js && apt-get update
|
RUN apt-get install -y software-properties-common && add-apt-repository ppa:chris-lea/node.js && apt-get update
|
||||||
RUN apt-get install -y build-essential curl postgresql-client-9.3 nodejs git
|
RUN apt-get install -y build-essential curl postgresql-client-9.3 nodejs git
|
||||||
|
|||||||
@@ -108,3 +108,11 @@ teardown() {
|
|||||||
echo "status: "$status
|
echo "status: "$status
|
||||||
assert_success
|
assert_success
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "dockerfile port exposure" {
|
||||||
|
deploy_app dockerfile
|
||||||
|
run bash -c "grep upstream $DOKKU_ROOT/$TEST_APP/nginx.conf | grep 3000"
|
||||||
|
echo "output: "$output
|
||||||
|
echo "status: "$status
|
||||||
|
assert_success
|
||||||
|
}
|
||||||
Reference in new issue
Block a user