Skip to content

Commit f357e51

Browse files
authored
build with tar if there are symlinks in the directory (#372)
1 parent 818139b commit f357e51

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

dist/bin/kctf-challenge

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,12 @@ function build_image {
127127
CONTAINER_DIR="${CHALLENGE_DIR}/${CONTAINER_NAME}"
128128
_kctf_log "building image in \"${CONTAINER_DIR}\""
129129
IIDFILE="$(mktemp)"
130-
docker build "${CONTAINER_DIR}" --iidfile "${IIDFILE}"
130+
if find "${CONTAINER_DIR}" -type l -exec false {} + >/dev/null 2>/dev/null; then
131+
docker build "${CONTAINER_DIR}" --iidfile "${IIDFILE}"
132+
else
133+
_kctf_log "found symlink, building with tar -czh | docker"
134+
tar -C "${CONTAINER_DIR}" -czh . | docker build --iidfile "${IIDFILE}" -
135+
fi
131136
if [[ $? -ne 0 ]]; then
132137
rm "${IIDFILE}"
133138
return 1

0 commit comments

Comments
 (0)