Skip to content

Commit

Permalink
Merge pull request #1261 from openziti/quickstart-local-image
Browse files Browse the repository at this point in the history
create quickstart local image builder unless existing builder
qrkourier authored Aug 23, 2023
2 parents ed3b449 + 4323603 commit c08a68d
Showing 3 changed files with 14 additions and 20 deletions.
17 changes: 4 additions & 13 deletions quickstart/docker/README.md
Original file line number Diff line number Diff line change
@@ -21,25 +21,16 @@ First, decide what you are trying to do. Are you trying to:
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 <tagname>`
1. Optionally, you may provide an argument, e.g., `./createLocalImage.sh <tagname>`, to create a tag
other than `latest`.

## 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 <tagname>`

## ERROR: existing instance for "ziti-builder"
When running the `./createLocalImage.sh` script, you might get this error:
```
ERROR: existing instance for "ziti-builder" but no append mode, specify --node to make changes for existing instances
```
It's probably safest to just remove the buildx builder using:
```
docker buildx rm ziti-builder
```

1. Optionally, you may provide an argument, e.g., `./createLocalImage.sh <tagname>`, to create a tag
other than `latest`.

## Build Docker Image For Publication
To publish the latest `ziti` CLI, use [the GitHub Action](https://github.com/openziti/ziti/actions/workflows/push-quickstart.yml).
6 changes: 3 additions & 3 deletions quickstart/docker/image/fetch-ziti-bins.sh
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ dest="${1}"
if [ -d /docker.build.context/ziti-bin ]; then
mv /docker.build.context/ziti-bin/ "${dest}"
else
source /docker.build.context/ziti-cli-functions.sh
getZiti
mv "${ZITI_BIN_DIR}" "${dest}"
source /docker.build.context/ziti-cli-functions.sh
getZiti
mv "${ZITI_BIN_DIR}" "${dest}"
fi
11 changes: 7 additions & 4 deletions quickstart/docker/pushLatestDocker.sh
Original file line number Diff line number Diff line change
@@ -21,8 +21,6 @@ if [ -z "${IMAGE_TAG}" ]; then
echo "image tag name was not provided, using default '${IMAGE_TAG}'"
fi

docker buildx create --use --name=ziti-builder

if [ "local" == "${1}" ]; then
echo "LOADING LOCALLY instead of pushing to dockerhub"
_BUILDX_PLATFORM=""
@@ -31,8 +29,13 @@ else
_BUILDX_PLATFORM="--platform linux/amd64,linux/arm64"
_BUILDX_ACTION="--push"
fi
docker buildx build ${_BUILDX_PLATFORM} "${SCRIPT_DIR}/image" \

docker buildx create \
--use --name=ziti-builder --driver docker-container 2>/dev/null \
|| docker buildx use --default ziti-builder

eval docker buildx build "${_BUILDX_PLATFORM}" "${SCRIPT_DIR}/image" \
--build-arg ZITI_VERSION_OVERRIDE="v${ZITI_VERSION}" \
--tag "openziti/quickstart:${ZITI_VERSION}" \
--tag "openziti/quickstart:${IMAGE_TAG}" \
${_BUILDX_ACTION}
"${_BUILDX_ACTION}"

0 comments on commit c08a68d

Please sign in to comment.