Skip to content

Commit e745fb7

Browse files
committed
[update] : add external workdir option for docker build
1 parent 27d230f commit e745fb7

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tools/docker-build.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ _usage () {
2222
echo " General options:"
2323
echo " -o | --build-opiton \"[options]\" Set build options passed to build.sh"
2424
echo " -d | --dist-out-dir \"[path]\" Set distributions' output directory"
25+
echo " -w | --work-dir \"[path]\" Set build working dir for debug"
2526
echo " -n | --noninteractive The process will not ask you any questions"
2627
echo " -c | --clean Enable --no-cache option when building docker image"
2728
echo " -s | --no-share-pkgfile Disable pacman pkgcache"
@@ -64,6 +65,14 @@ while (( $# > 0 )); do
6465
DIST_DIR=$(cd -P ${2} && pwd)
6566
shift 2
6667
;;
68+
-w | --work-dir)
69+
mkdir -p ${2} || {
70+
echo "Error: failed creating working directory: ${2}" 1>&2
71+
exit 1
72+
}
73+
EXTERNAL_WORK_DIR=$(cd -P ${2} && pwd)
74+
shift 2
75+
;;
6776
-n | --noninteractive)
6877
BUILD_SCRIPT_OPTS+=(--noconfirm)
6978
shift 1
@@ -108,6 +117,8 @@ done
108117
DOCKER_RUN_OPTS=()
109118
DOCKER_RUN_OPTS+=(-v "${DIST_DIR}:/alterlinux/out")
110119
DOCKER_RUN_OPTS+=(-v "/usr/lib/modules:/usr/lib/modules:ro")
120+
[[ "x${EXTERNAL_WORK_DIR}" != "x" ]] && \
121+
DOCKER_RUN_OPTS+=(-v "${EXTERNAL_WORK_DIR}:/alterlinux/work")
111122
[[ "x${NO_SHARE_PKG}" != "xTrue" ]] && {
112123
DOCKER_RUN_OPTS+=(-v "${SHARE_PKG_DIR}:/var/cache/pacman/pkg")
113124
DOCKER_RUN_OPTS+=(-v "${SHARE_DB_DIR}:/var/lib/pacman/sync")

0 commit comments

Comments
 (0)