mirror of
https://github.com/dokku/dokku.git
synced 2025-12-29 00:25:08 +01:00
Merge pull request #3449 from dokku/3263-copy-from-image
Only override the `WORKDIR` in copy_from_image if the image is `gliderlabs/herokuish` based
This commit is contained in:
@@ -275,9 +275,13 @@ get_running_image_tag() {
|
||||
|
||||
is_image_herokuish_based() {
|
||||
declare desc="returns true if app image is based on herokuish"
|
||||
# circleci can't support --rm as they run lxc in lxc
|
||||
[[ ! -f "/home/ubuntu/.circlerc" ]] && local DOCKER_ARGS="--rm"
|
||||
docker run "$DOKKU_GLOBAL_RUN_ARGS" --entrypoint="/bin/sh" $DOCKER_ARGS "$@" -c "test -f /exec" &>/dev/null
|
||||
declare IMAGE="$1"
|
||||
local USER_VALUE
|
||||
|
||||
# due to how the build process works, all herokuish images have the Environment variable USER=herokuishuser
|
||||
USER_VALUE="$(docker inspect -f '{{range .Config.Env}}{{if eq . "USER=herokuishuser" }}{{println .}}{{end}}{{end}}' "$IMAGE")"
|
||||
[[ "$USER_VALUE" == "" ]] && return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
get_docker_version() {
|
||||
@@ -346,16 +350,21 @@ parse_args() {
|
||||
|
||||
copy_from_image() {
|
||||
declare desc="copy file from named image to destination"
|
||||
local IMAGE="$1"
|
||||
local SRC_FILE="$2"
|
||||
local DST_DIR="$3"
|
||||
declare IMAGE="$1" SRC_FILE="$2" DST_DIR="$3"
|
||||
local WORK_DIR=""
|
||||
verify_app_name "$APP"
|
||||
|
||||
if verify_image "$IMAGE"; then
|
||||
if ! is_abs_path "$SRC_FILE"; then
|
||||
local WORKDIR=$(docker inspect -f '{{.Config.WorkingDir}}' "$IMAGE")
|
||||
[[ -z "$WORKDIR" ]] && local WORKDIR=/app
|
||||
local SRC_FILE="$WORKDIR/$SRC_FILE"
|
||||
if is_image_herokuish_based "$IMAGE"; then
|
||||
WORKDIR="/app"
|
||||
else
|
||||
WORKDIR="$(docker inspect -f '{{.Config.WorkingDir}}' "$IMAGE")"
|
||||
fi
|
||||
|
||||
if [[ -n "$WORKDIR" ]]; then
|
||||
SRC_FILE="${WORKDIR}/${SRC_FILE}"
|
||||
fi
|
||||
fi
|
||||
local CID=$(docker create "$DOKKU_GLOBAL_RUN_ARGS" "$IMAGE")
|
||||
docker cp "$CID:$SRC_FILE" "$DST_DIR"
|
||||
|
||||
Reference in New Issue
Block a user