Merge pull request #1311 from progrium/kilianc_hotfix-#1259
ignore protocol of Dockerfile EXPOSE (refs: #1280)
This commit is contained in:
commit
8905387d16
5 files changed
+41
-2
No files matched your search
@@ -36,7 +36,7 @@ case "$1" in
|
|||||||
|
|
||||||
dockerfile)
|
dockerfile)
|
||||||
# extract first port from Dockerfile
|
# extract first port from Dockerfile
|
||||||
DOCKERFILE_PORT=$(grep EXPOSE Dockerfile | head -1 | awk '{ print $2 }' || true)
|
DOCKERFILE_PORT=$(get_dockerfile_exposed_port Dockerfile)
|
||||||
[[ -n "$DOCKERFILE_PORT" ]] && dokku config:set-norestart $APP DOKKU_DOCKERFILE_PORT=$DOCKERFILE_PORT
|
[[ -n "$DOCKERFILE_PORT" ]] && dokku config:set-norestart $APP DOKKU_DOCKERFILE_PORT=$DOCKERFILE_PORT
|
||||||
|
|
||||||
# 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!!!
|
||||||
|
|||||||
@@ -201,3 +201,12 @@ get_container_ids() {
|
|||||||
shopt -u nullglob
|
shopt -u nullglob
|
||||||
echo $DOKKU_CIDS
|
echo $DOKKU_CIDS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_dockerfile_exposed_port() {
|
||||||
|
local DOCKERFILE_PORT=$(grep "^EXPOSE \+[[:digit:]]\+\(\/tcp\)\? *$" $1 | head -1 | sed 's/EXPOSE \+\([[:digit:]]\+\)\(\/tcp\)\?.*/\1/' || true)
|
||||||
|
if [[ -n "$DOCKERFILE_PORT" ]]; then
|
||||||
|
echo "$DOCKERFILE_PORT"
|
||||||
|
else
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
}
|
||||||
@@ -2,7 +2,9 @@ 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 3000
|
EXPOSE 3001/udp
|
||||||
|
EXPOSE 3000/tcp
|
||||||
|
EXPOSE 3003
|
||||||
|
|
||||||
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
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ load test_helper
|
|||||||
setup() {
|
setup() {
|
||||||
[[ -f "$DOKKU_ROOT/VHOST" ]] && cp -f "$DOKKU_ROOT/VHOST" "$DOKKU_ROOT/VHOST.bak"
|
[[ -f "$DOKKU_ROOT/VHOST" ]] && cp -f "$DOKKU_ROOT/VHOST" "$DOKKU_ROOT/VHOST.bak"
|
||||||
[[ -f "$DOKKU_ROOT/HOSTNAME" ]] && cp -f "$DOKKU_ROOT/HOSTNAME" "$DOKKU_ROOT/HOSTNAME.bak"
|
[[ -f "$DOKKU_ROOT/HOSTNAME" ]] && cp -f "$DOKKU_ROOT/HOSTNAME" "$DOKKU_ROOT/HOSTNAME.bak"
|
||||||
|
DOCKERFILE="$BATS_TMPDIR/Dockerfile"
|
||||||
}
|
}
|
||||||
|
|
||||||
teardown() {
|
teardown() {
|
||||||
@@ -162,3 +163,29 @@ check_urls() {
|
|||||||
|
|
||||||
check_urls http://my-cool-guy-test-app.127.0.0.1.xip.io
|
check_urls http://my-cool-guy-test-app.127.0.0.1.xip.io
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "(core) port exposure (dockerfile raw port)" {
|
||||||
|
source "$PLUGIN_PATH/common/functions"
|
||||||
|
cat<<EOF > $DOCKERFILE
|
||||||
|
EXPOSE 3001/udp
|
||||||
|
EXPOSE 3003
|
||||||
|
EXPOSE 3000/tcp
|
||||||
|
EOF
|
||||||
|
run get_dockerfile_exposed_port $DOCKERFILE
|
||||||
|
echo "output: "$output
|
||||||
|
echo "status: "$status
|
||||||
|
assert_output 3003
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "(core) port exposure (dockerfile tcp port)" {
|
||||||
|
source "$PLUGIN_PATH/common/functions"
|
||||||
|
cat<<EOF > $DOCKERFILE
|
||||||
|
EXPOSE 3001/udp
|
||||||
|
EXPOSE 3000/tcp
|
||||||
|
EXPOSE 3003
|
||||||
|
EOF
|
||||||
|
run get_dockerfile_exposed_port $DOCKERFILE
|
||||||
|
echo "output: "$output
|
||||||
|
echo "status: "$status
|
||||||
|
assert_output 3000
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
# constants
|
# constants
|
||||||
DOKKU_ROOT=${DOKKU_ROOT:=~dokku}
|
DOKKU_ROOT=${DOKKU_ROOT:=~dokku}
|
||||||
|
PLUGIN_PATH=${PLUGIN_PATH:="/var/lib/dokku/plugins"}
|
||||||
TEST_APP=my-cool-guy-test-app
|
TEST_APP=my-cool-guy-test-app
|
||||||
|
|
||||||
# test functions
|
# test functions
|
||||||
|
|||||||
Reference in new issue
Block a user