initial pass at switching to herokuish. closes #1091

This commit is contained in:
Michael Hobbs
2015-04-20 16:32:18 -07:00
parent aa55f027a4
commit 0840d8fd1f
19 changed files with 93 additions and 89 deletions

View File

@@ -11,14 +11,14 @@ case "$1" in
pushd "$TMP_WORK_DIR" &> /dev/null
case "$IMAGE_SOURCE_TYPE" in
buildstep)
herokuish)
id=$(tar -c . | docker run -i -a stdin $DOKKU_IMAGE /bin/bash -c "mkdir -p /app && tar -xC /app")
test "$(docker wait $id)" -eq 0
docker commit $id $IMAGE > /dev/null
[[ -d $CACHE_DIR ]] || mkdir $CACHE_DIR
# *DEPRECATED* in v0.4.0: `pluginhook pre-build` will be removed in future releases
pluginhook pre-build "$APP"
pluginhook pre-build-buildstep "$APP"
pluginhook pre-build-herokuish "$APP"
# *DEPRECATED* in v0.3.14: `pluginhook docker-args` will be removed in future releases
# https://github.com/progrium/dokku/issues/896 & https://github.com/progrium/dokku/issues/906
@@ -31,7 +31,7 @@ case "$1" in
# *DEPRECATED* in v0.4.0: `pluginhook post-build` will be removed in future releases
pluginhook post-build "$APP"
pluginhook post-build-buildstep "$APP"
pluginhook post-build-herokuish "$APP"
;;
dockerfile)
@@ -39,7 +39,7 @@ case "$1" in
DOCKERFILE_PORT=$(grep EXPOSE Dockerfile | head -1 | awk '{ print $2 }' || true)
[[ -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!!!
# herokuish pluginhooks don't necessarily make sense for dockerfiles. call the new breed!!!
pluginhook pre-build-dockerfile "$APP"
[[ "$DOKKU_DOCKERFILE_CACHE_BUILD" == "false" ]] && DOKKU_DOCKER_BUILD_OPTS="$DOKKU_DOCKER_BUILD_OPTS --no-cache"
@@ -57,10 +57,10 @@ case "$1" in
release)
APP="$2"; IMAGE="dokku/$APP"; IMAGE_SOURCE_TYPE="$3"
case "$IMAGE_SOURCE_TYPE" in
buildstep)
herokuish)
# *DEPRECATED* in v0.4.0: `pluginhook pre-release` will be removed in future releases
pluginhook pre-release "$APP"
pluginhook pre-release-buildstep "$APP"
pluginhook pre-release-herokuish "$APP"
if [[ -f "$DOKKU_ROOT/ENV" ]]; then
id=$(docker run -i -a stdin $IMAGE /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/00-global-env.sh" < "$DOKKU_ROOT/ENV")
test "$(docker wait $id)" -eq 0
@@ -73,11 +73,11 @@ case "$1" in
fi
# *DEPRECATED* in v0.4.0: `pluginhook post-release` will be removed in future releases
pluginhook post-release "$APP"
pluginhook post-release-buildstep "$APP"
pluginhook post-release-herokuish "$APP"
;;
dockerfile)
# buildstep pluginhooks don't necessarily make sense for dockerfiles. call the new breed!!!
# herokuish pluginhooks don't necessarily make sense for dockerfiles. call the new breed!!!
pluginhook pre-release-dockerfile "$APP"
pluginhook post-release-dockerfile "$APP"
;;
@@ -170,7 +170,7 @@ case "$1" in
DOCKER_ARGS+=$(: | pluginhook docker-args-run $APP)
[[ $DOKKU_RM_CONTAINER ]] && DOKKU_RUN_OPTS="--rm"
has_tty && DOKKU_RUN_OPTS+=" -i -t"
is_image_buildstep_based "$IMAGE" && EXEC_CMD="/exec"
is_image_herokuish_based "$IMAGE" && EXEC_CMD="/exec"
docker run $DOKKU_RUN_OPTS $DOCKER_ARGS $IMAGE $EXEC_CMD "$@"
;;

View File

@@ -131,7 +131,7 @@ verify_image() {
fi
}
is_image_buildstep_based() {
is_image_herokuish_based() {
# circleci can't support --rm as they run lxc in lxc
[[ ! -f "/home/ubuntu/.circlerc" ]] && local DOCKER_ARGS="--rm"
docker run --entrypoint="/bin/bash" $DOCKER_ARGS "$@" -c "[[ -f /exec ]]"

View File

@@ -5,7 +5,7 @@ source "$(dirname $0)/../common/functions"
STDIN=$(cat); APP="$1"; IMAGE="dokku/$APP"
DOCKERFILE_ENV_FILE="$DOKKU_ROOT/$APP/DOCKERFILE_ENV_FILE"
if ! is_image_buildstep_based "$IMAGE"; then
if ! is_image_herokuish_based "$IMAGE"; then
> "$DOCKERFILE_ENV_FILE"
[[ -f "$DOKKU_ROOT/ENV" ]] && sed -e "s:^export ::g" -e "s:=':=:g" -e "s:'$::g" "$DOKKU_ROOT/ENV" > "$DOCKERFILE_ENV_FILE"
[[ -f "$DOKKU_ROOT/$APP/ENV" ]] && sed -e "s:^export ::g" -e "s:=':=:g" -e "s:'$::g" "$DOKKU_ROOT/$APP/ENV" >> "$DOCKERFILE_ENV_FILE"

View File

@@ -23,7 +23,7 @@ git_build_app_repo() {
if [[ -f Dockerfile ]] && [[ "$([[ -f .env ]] && grep -q BUILDPACK_URL .env; echo $?)" != "0" ]] && [[ ! -f ".buildpacks" ]]; then
dokku receive "$APP" "dockerfile" "$TMP_WORK_DIR" | sed -u "s/^/"$'\e[1G'"/"
else
dokku receive "$APP" "buildstep" "$TMP_WORK_DIR" | sed -u "s/^/"$'\e[1G'"/"
dokku receive "$APP" "herokuish" "$TMP_WORK_DIR" | sed -u "s/^/"$'\e[1G'"/"
fi
}

View File

@@ -6,9 +6,9 @@ release_and_deploy() {
source "$(dirname $0)/../common/functions"
local APP="$1"; local IMAGE="dokku/$APP"
if verify_image "$IMAGE"; then
if is_image_buildstep_based "$IMAGE"; then
IMAGE_SOURCE_TYPE="buildstep"
if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]]; then
if is_image_herokuish_based "$IMAGE"; then
IMAGE_SOURCE_TYPE="herokuish"
else
IMAGE_SOURCE_TYPE="dockerfile"
fi