[fixing] docker parts

This commit is contained in:
Jacen 2017-08-31 13:51:08 +02:00 committed by XECDesign
parent e64ea5bce4
commit 727db0ed63

View File

@ -13,7 +13,6 @@ if ! $DOCKER ps >/dev/null; then
fi fi
set -e set -e
config_mount=() config_mount=()
if [ -f config ]; then if [ -f config ]; then
config_mount=("-v" "$(pwd)/config:/pi-gen/config:ro") config_mount=("-v" "$(pwd)/config:/pi-gen/config:ro")
@ -47,13 +46,13 @@ fi
if [ "$CONTAINER_EXISTS" != "" ] && [ "$CONTINUE" != "1" ]; then if [ "$CONTAINER_EXISTS" != "" ] && [ "$CONTINUE" != "1" ]; then
echo "Container $CONTAINER_NAME already exists and you did not specify CONTINUE=1. Aborting." echo "Container $CONTAINER_NAME already exists and you did not specify CONTINUE=1. Aborting."
echo "You can delete the existing container like this:" echo "You can delete the existing container like this:"
echo " docker rm -v $CONTAINER_NAME" echo " $DOCKER rm -v $CONTAINER_NAME"
exit 1 exit 1
fi fi
$DOCKER build -t pi-gen . $DOCKER build -t pi-gen .
if [ "$CONTAINER_EXISTS" != "" ]; then if [ "$CONTAINER_EXISTS" != "" ]; then
trap "echo 'got CTRL+C... please wait 5s';docker stop -t 5 ${CONTAINER_NAME}_cont" SIGINT SIGTERM trap "echo 'got CTRL+C... please wait 5s'; $DOCKER stop -t 5 ${CONTAINER_NAME}_cont" SIGINT SIGTERM
time $DOCKER run --rm --privileged \ time $DOCKER run --rm --privileged \
--volumes-from="${CONTAINER_NAME}" --name "${CONTAINER_NAME}_cont" \ --volumes-from="${CONTAINER_NAME}" --name "${CONTAINER_NAME}_cont" \
-e IMG_NAME=${IMG_NAME}\ -e IMG_NAME=${IMG_NAME}\
@ -63,8 +62,8 @@ if [ "$CONTAINER_EXISTS" != "" ]; then
rsync -av work/*/build.log deploy/" & rsync -av work/*/build.log deploy/" &
wait wait
else else
trap "echo 'got CTRL+C... please wait 5s'; docker stop -t 5 ${CONTAINER_NAME}" SIGINT SIGTERM trap "echo 'got CTRL+C... please wait 5s'; $DOCKER stop -t 5 ${CONTAINER_NAME}" SIGINT SIGTERM
$DOCKER run --name "${CONTAINER_NAME}" --privileged \ time $DOCKER run --name "${CONTAINER_NAME}" --privileged \
-e IMG_NAME=${IMG_NAME}\ -e IMG_NAME=${IMG_NAME}\
-v "$(pwd)/deploy:/pi-gen/deploy" \ -v "$(pwd)/deploy:/pi-gen/deploy" \
"${config_mount[@]}" \ "${config_mount[@]}" \
@ -73,5 +72,6 @@ else
cd /pi-gen; ./build.sh && cd /pi-gen; ./build.sh &&
rsync -av work/*/build.log deploy/" & rsync -av work/*/build.log deploy/" &
wait wait
$DOCKER rm -v $CONTAINER_NAME
fi fi
echo "Done! Your image(s) should be in deploy/" echo "Done! Your image(s) should be in deploy/"