mirror of
https://github.com/jessfraz/dockerfiles.git
synced 2024-11-23 11:31:49 +01:00
update
Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
This commit is contained in:
parent
ef0a7f463f
commit
f37b405511
8
bashrc
8
bashrc
|
@ -18,7 +18,7 @@ command_not_found_handle () {
|
||||||
# would prevent the container from starting)
|
# would prevent the container from starting)
|
||||||
DEVICES=
|
DEVICES=
|
||||||
for DEV in /dev/kvm /dev/ttyUSB* /dev/dri/* /dev/snd/*; do
|
for DEV in /dev/kvm /dev/ttyUSB* /dev/dri/* /dev/snd/*; do
|
||||||
if [ -b "$DEV" -o -c "$DEV" ]; then
|
if [ -b "$DEV" ] || [ -c "$DEV" ]; then
|
||||||
DEVICES="$DEVICES --device $DEV:$DEV"
|
DEVICES="$DEVICES --device $DEV:$DEV"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -36,9 +36,13 @@ command_not_found_handle () {
|
||||||
DASHT=
|
DASHT=
|
||||||
tty -s && DASHT=-t
|
tty -s && DASHT=-t
|
||||||
|
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
# shellcheck disable=SC2046
|
||||||
docker run $DASHT -i -u $(whoami) -w "$HOME" \
|
docker run $DASHT -i -u $(whoami) -w "$HOME" \
|
||||||
$(env | cut -d= -f1 | awk '{print "-e", $1}') \
|
$(env | cut -d= -f1 | awk '{print "-e", $1}') \
|
||||||
$DOCKERFILES_RUN_FLAGS $DEVICES $VOLUMES \
|
$DOCKERFILES_RUN_FLAGS \
|
||||||
|
$DEVICES \
|
||||||
|
$VOLUMES \
|
||||||
-v /etc/passwd:/etc/passwd:ro \
|
-v /etc/passwd:/etc/passwd:ro \
|
||||||
-v /etc/group:/etc/group:ro \
|
-v /etc/group:/etc/group:ro \
|
||||||
-v /etc/localtime:/etc/localtime:ro \
|
-v /etc/localtime:/etc/localtime:ro \
|
||||||
|
|
31
build-all.sh
31
build-all.sh
|
@ -14,8 +14,7 @@ build_and_push(){
|
||||||
build_dir=$3
|
build_dir=$3
|
||||||
|
|
||||||
echo "Building ${REPO_URL}/${base}:${suite} for context ${build_dir}"
|
echo "Building ${REPO_URL}/${base}:${suite} for context ${build_dir}"
|
||||||
docker build --rm --force-rm -t ${REPO_URL}/${base}:${suite} ${build_dir} || return 1
|
docker build --rm --force-rm -t "${REPO_URL}/${base}:${suite}" "${build_dir}" || return 1
|
||||||
img build -t ${REPO_URL}/${base}:${suite} ${build_dir} || true
|
|
||||||
|
|
||||||
# on successful build, push the image
|
# on successful build, push the image
|
||||||
echo " --- "
|
echo " --- "
|
||||||
|
@ -26,16 +25,16 @@ build_and_push(){
|
||||||
# absolutely no reason
|
# absolutely no reason
|
||||||
n=0
|
n=0
|
||||||
until [ $n -ge 5 ]; do
|
until [ $n -ge 5 ]; do
|
||||||
docker push --disable-content-trust=false ${REPO_URL}/${base}:${suite} && break
|
docker push --disable-content-trust=false "${REPO_URL}/${base}:${suite}" && break
|
||||||
echo "Try #$n failed... sleeping for 15 seconds"
|
echo "Try #$n failed... sleeping for 15 seconds"
|
||||||
n=$[$n+1]
|
n=$((n+1))
|
||||||
sleep 15
|
sleep 15
|
||||||
done
|
done
|
||||||
|
|
||||||
# also push the tag latest for "stable" (chrome), "tools" (wireguard) or "3.5" tags for zookeeper
|
# also push the tag latest for "stable" (chrome), "tools" (wireguard) or "3.5" tags for zookeeper
|
||||||
if [[ "$suite" == "stable" ]] || [[ "$suite" == "3.5" ]] || [[ "$suite" == "tools" ]]; then
|
if [[ "$suite" == "stable" ]] || [[ "$suite" == "3.5" ]] || [[ "$suite" == "tools" ]]; then
|
||||||
docker tag ${REPO_URL}/${base}:${suite} ${REPO_URL}/${base}:latest
|
docker tag "${REPO_URL}/${base}:${suite}" "${REPO_URL}/${base}:latest"
|
||||||
docker push --disable-content-trust=false ${REPO_URL}/${base}:latest
|
docker push --disable-content-trust=false "${REPO_URL}/${base}:latest"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +42,7 @@ dofile() {
|
||||||
f=$1
|
f=$1
|
||||||
image=${f%Dockerfile}
|
image=${f%Dockerfile}
|
||||||
base=${image%%\/*}
|
base=${image%%\/*}
|
||||||
build_dir=$(dirname $f)
|
build_dir=$(dirname "$f")
|
||||||
suite=${build_dir##*\/}
|
suite=${build_dir##*\/}
|
||||||
|
|
||||||
if [[ -z "$suite" ]] || [[ "$suite" == "$base" ]]; then
|
if [[ -z "$suite" ]] || [[ "$suite" == "$base" ]]; then
|
||||||
|
@ -54,7 +53,7 @@ dofile() {
|
||||||
$SCRIPT build_and_push "${base}" "${suite}" "${build_dir}"
|
$SCRIPT build_and_push "${base}" "${suite}" "${build_dir}"
|
||||||
} || {
|
} || {
|
||||||
# add to errors
|
# add to errors
|
||||||
echo "${base}:${suite}" >> $ERRORS
|
echo "${base}:${suite}" >> "$ERRORS"
|
||||||
}
|
}
|
||||||
echo
|
echo
|
||||||
echo
|
echo
|
||||||
|
@ -63,31 +62,31 @@ echo
|
||||||
main(){
|
main(){
|
||||||
# get the dockerfiles
|
# get the dockerfiles
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
files=( $(find -L . -iname '*Dockerfile' | sed 's|./||' | sort) )
|
mapfile -t files < <(find -L . -iname '*Dockerfile' | sed 's|./||' | sort)
|
||||||
unset IFS
|
unset IFS
|
||||||
|
|
||||||
# build all dockerfiles
|
# build all dockerfiles
|
||||||
echo "Running in parallel with ${JOBS} jobs."
|
echo "Running in parallel with ${JOBS} jobs."
|
||||||
parallel --tag --verbose --ungroup -j"${JOBS}" $SCRIPT dofile "{1}" ::: "${files[@]}"
|
parallel --tag --verbose --ungroup -j"${JOBS}" "$SCRIPT" dofile "{1}" ::: "${files[@]}"
|
||||||
|
|
||||||
if [[ ! -f $ERRORS ]]; then
|
if [[ ! -f "$ERRORS" ]]; then
|
||||||
echo "No errors, hooray!"
|
echo "No errors, hooray!"
|
||||||
else
|
else
|
||||||
echo "[ERROR] Some images did not build correctly, see below." >&2
|
echo "[ERROR] Some images did not build correctly, see below." >&2
|
||||||
echo "These images failed: $(cat $ERRORS)" >&2
|
echo "These images failed: $(cat "$ERRORS")" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
run(){
|
run(){
|
||||||
args=$@
|
args=$*
|
||||||
f=$1
|
f=$1
|
||||||
|
|
||||||
if [[ "$f" == "" ]]; then
|
if [[ "$f" == "" ]]; then
|
||||||
main $args
|
main "$args"
|
||||||
else
|
else
|
||||||
$args
|
"$args"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
run $@
|
run "$@"
|
||||||
|
|
|
@ -16,8 +16,7 @@ set -e
|
||||||
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
||||||
DAEMON=/usr/bin/distccd
|
DAEMON=/usr/bin/distccd
|
||||||
NAME=distccd
|
NAME=distccd
|
||||||
DESC="Distributed Compiler Daemon"
|
DAEMON_ARGS="--nice=10 --port=4200 --pid-file=/var/run/${NAME}.pid --no-detach $*"
|
||||||
DAEMON_ARGS="--nice=10 --port=4200 --pid-file=/var/run/$NAME.pid --no-detach $@"
|
|
||||||
|
|
||||||
test -x $DAEMON || exit 0
|
test -x $DAEMON || exit 0
|
||||||
|
|
||||||
|
@ -26,4 +25,5 @@ test -x $DAEMON || exit 0
|
||||||
touch /var/run/$NAME.pid
|
touch /var/run/$NAME.pid
|
||||||
chown distccd /var/run/$NAME.pid
|
chown distccd /var/run/$NAME.pid
|
||||||
|
|
||||||
|
# shellcheck disable=SC2086
|
||||||
exec $DAEMON $DAEMON_ARGS
|
exec $DAEMON $DAEMON_ARGS
|
||||||
|
|
Loading…
Reference in New Issue
Block a user