Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix docker build #22

Merged
merged 4 commits into from
May 21, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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*"

25 changes: 12 additions & 13 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 @@ -95,7 +96,6 @@ _parse_build_default_path()
while [[ "${#}" -gt 0 ]]
do
key="${1}"
echo "${key}"
case "${key}" in
--build-defaults |--build_defaults)
PATH_PROJECT_DEFAULTS_PATH="${2}"
Expand All @@ -118,7 +118,6 @@ _parse()
while [[ "${#}" -gt 0 ]]
do
key="${1}"
echo "${key}"
case "${key}" in
--skip-build | --skip_build)
DOCKER_SKIP_BUILD="true"
Expand Down Expand Up @@ -203,12 +202,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 +241,3 @@ _main()
}

_main "${@}"