Skip to content

Commit 21b059f

Browse files
authored
Merge pull request #58 from dokku-community/57-cidfile
fix: use a cidfile for getting the created container id
2 parents 72e41ee + cb16d4d commit 21b059f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

builder-create-dokku-image

+10-1
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,20 @@ hook-apt-builder-create-dokku-image() {
3232
return
3333
fi
3434

35+
CID_FILE="$(mktemp "/tmp/dokku-${DOKKU_PID}-${FUNCNAME[0]}.XXXXXX")"
3536
dokku_log_info1 "Creating extended app image with custom system packages"
3637
pushd "$TMP_WORK_DIR" >/dev/null
3738
# shellcheck disable=SC2086
38-
CID=$(tar -c . | "$DOCKER_BIN" container run "${DOCKER_RUN_LABEL_ARGS[@]}" $DOKKU_GLOBAL_RUN_ARGS -i -a stdin "$DOKKU_IMAGE" /bin/bash -c "mkdir -p /tmp/apt && tar -xC /tmp/apt")
39+
tar -c . | "$DOCKER_BIN" container run "${DOCKER_RUN_LABEL_ARGS[@]}" $DOKKU_GLOBAL_RUN_ARGS -i -a stdin --cidfile="$CID_FILE" "$DOKKU_IMAGE" /bin/bash -c "mkdir -p /tmp/apt && tar -xC /tmp/apt"
3940
popd >/dev/null
41+
42+
CID="$(cat "$CID_FILE")"
43+
rm -f "$CID_FILE"
44+
if [[ -z "$CID" ]]; then
45+
dokku_log_warn "Failure extracting apt files"
46+
return 1
47+
fi
48+
4049
if test "$("$DOCKER_BIN" container wait "$CID")" -ne 0; then
4150
dokku_log_warn "Failure extracting apt files"
4251
return 1

0 commit comments

Comments
 (0)