Merge pull request #1712 from progrium/1609_filter-link-with-dockerfile
filter incompatible docker option when building dockerfile vs herokuish apps
This commit is contained in:
@@ -459,7 +459,7 @@ dokku config:set --no-restart $APP MANUALLY_STOPPED=1
|
|||||||
|
|
||||||
- Description:
|
- Description:
|
||||||
- Invoked by: `dokku build`
|
- Invoked by: `dokku build`
|
||||||
- Arguments: `$APP`
|
- Arguments: `$APP $IMAGE_SOURCE_TYPE`
|
||||||
- Example:
|
- Example:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ case "$1" in
|
|||||||
[[ -d $CACHE_DIR ]] || mkdir $CACHE_DIR
|
[[ -d $CACHE_DIR ]] || mkdir $CACHE_DIR
|
||||||
plugn trigger pre-build-buildpack "$APP"
|
plugn trigger pre-build-buildpack "$APP"
|
||||||
|
|
||||||
DOCKER_ARGS=$(: | plugn trigger docker-args-build $APP)
|
DOCKER_ARGS=$(: | plugn trigger docker-args-build $APP $IMAGE_SOURCE_TYPE)
|
||||||
[[ "$DOKKU_TRACE" ]] && DOCKER_ARGS+=" -e TRACE=true "
|
[[ "$DOKKU_TRACE" ]] && DOCKER_ARGS+=" -e TRACE=true "
|
||||||
id=$(docker run -d -v $CACHE_DIR:/cache -e CACHE_PATH=/cache $DOCKER_ARGS $IMAGE /build)
|
id=$(docker run -d -v $CACHE_DIR:/cache -e CACHE_PATH=/cache $DOCKER_ARGS $IMAGE /build)
|
||||||
docker attach $id
|
docker attach $id
|
||||||
@@ -40,7 +40,7 @@ case "$1" in
|
|||||||
plugn trigger pre-build-dockerfile "$APP"
|
plugn trigger pre-build-dockerfile "$APP"
|
||||||
|
|
||||||
[[ "$DOKKU_DOCKERFILE_CACHE_BUILD" == "false" ]] && DOKKU_DOCKER_BUILD_OPTS="$DOKKU_DOCKER_BUILD_OPTS --no-cache"
|
[[ "$DOKKU_DOCKERFILE_CACHE_BUILD" == "false" ]] && DOKKU_DOCKER_BUILD_OPTS="$DOKKU_DOCKER_BUILD_OPTS --no-cache"
|
||||||
DOCKER_ARGS=$(: | plugn trigger docker-args-build $APP)
|
DOCKER_ARGS=$(: | plugn trigger docker-args-build $APP $IMAGE_SOURCE_TYPE)
|
||||||
docker build $DOCKER_ARGS $DOKKU_DOCKER_BUILD_OPTS -t "$IMAGE" .
|
docker build $DOCKER_ARGS $DOKKU_DOCKER_BUILD_OPTS -t "$IMAGE" .
|
||||||
|
|
||||||
plugn trigger post-build-dockerfile "$APP"
|
plugn trigger post-build-dockerfile "$APP"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
STDIN=$(cat)
|
STDIN=$(cat)
|
||||||
APP="$1"
|
APP="$1"; IMAGE_SOURCE_TYPE="$2"
|
||||||
|
|
||||||
case "$0" in
|
case "$0" in
|
||||||
*docker-args-build)
|
*docker-args-build)
|
||||||
@@ -34,7 +34,35 @@ if [[ -f "$PHASE_FILE_PATH" ]]; then
|
|||||||
continue
|
continue
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
output="$output $line"
|
case "$IMAGE_SOURCE_TYPE" in
|
||||||
|
dockerfile)
|
||||||
|
case "$line" in
|
||||||
|
--link*|-v*)
|
||||||
|
continue
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
output="$output $line"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
|
||||||
|
herokuish)
|
||||||
|
case "$line" in
|
||||||
|
--file*|--build-args*)
|
||||||
|
continue
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
output="$output $line"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
output="$output $line"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done < $PHASE_FILE_PATH
|
done < $PHASE_FILE_PATH
|
||||||
|
|||||||
@@ -160,3 +160,15 @@ teardown() {
|
|||||||
echo "status: "$status
|
echo "status: "$status
|
||||||
assert_success
|
assert_success
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "docker-options (dockerfile deploy with link)" {
|
||||||
|
run /bin/bash -c "dokku docker-options:add $TEST_APP deploy \"-v /var/tmp\""
|
||||||
|
echo "output: "$output
|
||||||
|
echo "status: "$status
|
||||||
|
assert_success
|
||||||
|
run /bin/bash -c "dokku docker-options:add $TEST_APP build \"--link postgres\""
|
||||||
|
echo "output: "$output
|
||||||
|
echo "status: "$status
|
||||||
|
assert_success
|
||||||
|
deploy_app dockerfile
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user