kuryr-kubernetes/tools/build_cni_daemonset_image
Michał Dulko eb428c1170 Clean up ENV vars mistmatches in Dockerfiles
Containerized deployment through DevStack had two bugs related to
mismatches in handling environment variables in Dockerfiles:

1. cni.Dockerfile was using ENV vars to define CNI bin and conf
directories, but when DevStack was building them it wasn't setting them
correctly. This resulted in CNI binaries and configs ending up
in wrong directories when deploying through DevStack. This is fixed by
passing $CNI_BIN_DIR and $CNI_CONF_DIR into the build function.
2. cni_builder script used $CNI_BIN_DIR_PATH, but it was only defined in
cni.Dockerfile and was is missing from cni_builder.Dockerfile. This
resulted in malformed kuryr-cni script, that pointed to non-existing
"/kuryr-cni-bin" file. This is fixed by adding those ENV vars to
cni_builder.Dockerfile

Change-Id: I4833124231f256b74f80bd5fee732686bffab77e
Closes-Bug: 1718137
2017-09-20 10:35:36 +02:00

24 lines
601 B
Bash
Executable File

#!/bin/bash -ex
CNI_BIN_DIR=$1
CNI_CONF_DIR=$2
BUILDER_TAG="kuryr/cni-builder"
CNI_TAG="kuryr/cni"
# build the cni image
if [ -z "$CNI_BIN_DIR" ] && [ -z "$CNI_CONF_DIR" ]; then
docker build -t "$BUILDER_TAG" -f cni_builder.Dockerfile .
else
docker build -t "$BUILDER_TAG" \
--build-arg "CNI_BIN_DIR_PATH=$CNI_BIN_DIR" \
--build-arg "CNI_CONFIG_DIR_PATH=$CNI_CONF_DIR" \
-f cni_builder.Dockerfile .
fi
docker run \
--rm \
-v $(pwd):/opt/kuryr-kubernetes \
"$BUILDER_TAG":latest
# create cni daemonset image
docker build -t "$CNI_TAG" -f cni.Dockerfile .