diff --git a/quickstart/docker/README.md b/quickstart/docker/README.md index 77516fb3e..b6ebbf772 100644 --- a/quickstart/docker/README.md +++ b/quickstart/docker/README.md @@ -15,17 +15,20 @@ First, decide what you are trying to do. Are you trying to: 1. copy the `ziti` CLI to `./ziti-bin`: `cp /path/to/ziti ./ziti-bin` 1. run the script `./createLocalImage.sh` which will create a `openziti/quickstart:latest` tag using the `ziti` CLI located in `./ziti-bin` + 1. Optionally, you may provide an argument for the image tag. `./createLocalImage.sh ` ## Build Docker Image for Docker-related Changes 1. change to this directory from checkout root: `cd quickstart/docker` 1. run the script `./createLocalImage.sh` which will create a `openziti/quickstart:latest` tag using the latest `ziti` [release from GitHub](https://github.com/openziti/ziti/releases/latest) + 1. Optionally, you may provide an argument for the image tag. `./createLocalImage.sh ` ## Build Docker Image with Specific ziti Version 1. change to this directory from checkout root: `cd quickstart/docker` 1. set `ZITI_VERSION_OVERRIDE` to desired version: `export ZITI_VERSION_OVERRIDE=v0.28.4` 1. run the script `./createLocalImage.sh` which will create a `openziti/quickstart:latest` tag using the specified version of `ziti` [from GitHub](https://github.com/openziti/ziti/releases/tag/v0.28.4) + 1. Optionally, you may provide an argument for the image tag. `./createLocalImage.sh ` ## ERROR: existing instance for "ziti-builder" When running the `./createLocalImage.sh` script, you might get this error: diff --git a/quickstart/docker/createLocalImage.sh b/quickstart/docker/createLocalImage.sh index e1170e45d..42fa9489b 100755 --- a/quickstart/docker/createLocalImage.sh +++ b/quickstart/docker/createLocalImage.sh @@ -17,4 +17,4 @@ else echo "" fi -$SCRIPT_DIR/pushLatestDocker.sh local \ No newline at end of file +$SCRIPT_DIR/pushLatestDocker.sh local "${1}" \ No newline at end of file diff --git a/quickstart/docker/image/run-router.sh b/quickstart/docker/image/run-router.sh index 2e72ab363..f38bfc664 100755 --- a/quickstart/docker/image/run-router.sh +++ b/quickstart/docker/image/run-router.sh @@ -12,6 +12,12 @@ if [[ "${ZITI_ROUTER_NAME-}" != "" ]]; then echo "_ZITI_ROUTER_NAME set to: ${_ZITI_ROUTER_NAME}" fi +# Wait until the file exists, then give one more second for the file to be completely written +until [ -f "${ZITI_HOME}/ziti.env" ] +do + sleep 1 +done +sleep 1 . ${ZITI_HOME}/ziti.env # wait for the controller to come online @@ -48,7 +54,7 @@ if [ ! -f "${_UNIQUE_NAME}" ]; then createPrivateRouterConfig "${ZITI_ROUTER_NAME}" fi - found=$(ziti edge list edge-routers 'name = "'"${ZITI_ROUTER_NAME}"'"' | grep -c "${ZITI_ROUTER_NAME}") + found=$("${ZITI_BIN_DIR-}/ziti" edge list edge-routers 'name = "'"${ZITI_ROUTER_NAME}"'"' | grep -c "${ZITI_ROUTER_NAME}") if [[ found -gt 0 ]]; then echo "---------- Found existing edge-router ${ZITI_ROUTER_NAME}...." else diff --git a/quickstart/docker/pushLatestDocker.sh b/quickstart/docker/pushLatestDocker.sh index 5110ede0e..d93d1780b 100755 --- a/quickstart/docker/pushLatestDocker.sh +++ b/quickstart/docker/pushLatestDocker.sh @@ -15,6 +15,12 @@ if [ -z "${ZITI_VERSION}" ]; then exit 1 fi +IMAGE_TAG="${2-}" +if [ -z "${IMAGE_TAG}" ]; then + IMAGE_TAG="latest" + echo "image tag name was not provided, using default '${IMAGE_TAG}'" +fi + docker buildx create --use --name=ziti-builder if [ "local" == "${1}" ]; then @@ -28,5 +34,5 @@ fi docker buildx build ${_BUILDX_PLATFORM} "${SCRIPT_DIR}/image" \ --build-arg ZITI_VERSION_OVERRIDE="v${ZITI_VERSION}" \ --tag "openziti/quickstart:${ZITI_VERSION}" \ - --tag "openziti/quickstart:latest" \ + --tag "openziti/quickstart:${IMAGE_TAG}" \ ${_BUILDX_ACTION} \ No newline at end of file