Skip to content

Commit

Permalink
Fix docker-build.sh
Browse files Browse the repository at this point in the history
A few bash variables were protected, causing
the build stage to fail.

Please consider using .ci/build-images instead
  • Loading branch information
Pedro Silva committed May 13, 2019
1 parent df8b9f4 commit 5a75617
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
3 changes: 1 addition & 2 deletions container/build_defaults.env
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ DOCKER_IMAGE_ARM_NAME="wm-gateway-rpi"
DOCKER_IMAGE_TAG="latest"
DOCKER_IMAGE_TAG_PYTHON_VERSION="false"

DOCKER_BUILD_CACHE=""
DOCKER_BUILD_CACHE=" "
#DOCKER_ARM_BUILD_TARGET="wm-lxgw-rpi"
#DOCKER_X86_BUILD_TARGET="wm-lxgw"

Expand All @@ -15,4 +15,3 @@ DOCKER_PLATFORM="x86"
# use to specify the the messaging or transport version
#DOCKER_BUILD_ARGS="--build-arg WM_MESSAGING_PKG=wirepas_messaging-1.1.0* \
# --build-arg WM_TRANSPORT_PKG=wirepas_gateway-1.1.0*"

23 changes: 12 additions & 11 deletions container/docker-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#

trap 'echo "Aborting due to errexit on line $LINENO. Exit code: $?" >&2' ERR
set -x
set -e
set -o nounset
set -o errexit
Expand Down Expand Up @@ -44,17 +45,17 @@ _defaults()

# default defaults if not defined in build file
DOCKER_IMAGE_TAG=${DOCKER_IMAGE_TAG:-"latest"}
DOCKER_BUILD_CACHE=${DOCKER_BUILD_CACHE:-""}
DOCKER_BUILD_CACHE=${DOCKER_BUILD_CACHE:-" "}
DOCKER_PLATFORM=${DOCKER_PLATFORM:-"x86"}
DOCKER_BUILD_TARGET=${DOCKER_BUILD_TARGET:-""}
DOCKER_BUILD_TARGET=${DOCKER_BUILD_TARGET:-" "}
DOCKER_FILE=${DOCKER_FILE:-"./container/dev/Dockerfile"}
DOCKER_REPO=${DOCKER_REPO:-""}
DOCKER_REPO=${DOCKER_REPO:-" "}
DOCKER_PUSH=${DOCKER_PUSH:-"false"}
DOCKER_SKIP_BUILD=${DOCKER_SKIP_BUILD:-"false"}
DOCKER_BUILD_ARGS=${DOCKER_BUILD_ARGS:-""}
DOCKER_BUILD_ARGS=${DOCKER_BUILD_ARGS:-" "}

DOCKER_IMAGE_ARM_NAME=${DOCKER_IMAGE_ARM_NAME:-""}
DOCKER_ARM_BUILD_TARGET=${DOCKER_ARM_BUILD_TARGET:-""}
DOCKER_IMAGE_ARM_NAME=${DOCKER_IMAGE_ARM_NAME:-" "}
DOCKER_ARM_BUILD_TARGET=${DOCKER_ARM_BUILD_TARGET:-" "}

DOCKER_IMAGE_TAG_PYTHON_VERSION=${DOCKER_IMAGE_TAG_PYTHON_VERSION:-"false"}
DOCKER_BUILD_GIT_HISTORY_LENGTH=${DOCKER_BUILD_GIT_HISTORY_LENGTH:-"10"}
Expand Down Expand Up @@ -203,12 +204,13 @@ _build()

_get_build_history || true
echo "building ${DOCKER_FILE} ${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG} [${DOCKER_BUILD_CACHE}] ${DOCKER_BUILD_ARGS}"
#shellcheck disable=SC2086
docker build \
--compress "${DOCKER_BUILD_CACHE}" \
--compress ${DOCKER_BUILD_CACHE} \
-t "${DOCKER_IMAGE_NAME}":"${DOCKER_IMAGE_TAG}" . \
-f "${DOCKER_FILE}" \
"${DOCKER_BUILD_TARGET}" \
"${DOCKER_BUILD_ARGS}"
-f ${DOCKER_FILE} \
${DOCKER_BUILD_TARGET} \
${DOCKER_BUILD_ARGS}
fi
}

Expand Down Expand Up @@ -241,4 +243,3 @@ _main()
}

_main "${@}"

0 comments on commit 5a75617

Please sign in to comment.