Skip to content

Commit

Permalink
Improve save-portable-container-image
Browse files Browse the repository at this point in the history
  • Loading branch information
tliron committed Mar 25, 2021
1 parent 2370c5d commit 3291041
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 19 deletions.
33 changes: 16 additions & 17 deletions QUICKSTART.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,10 @@ where we have scripts that do much of what is explained here.
Requirements
------------

To get started with Turandot you need `kubectl` access to a working Kubernetes
cluster.

For development work, [Minikube](https://minikube.sigs.k8s.io/docs/) is a quick way
to get started. Just make sure to start Minikube with its registry add-on enabled:
### Tools

minikube start --addons=registry ...

Download the CLI Utilities
--------------------------

[Download](https://github.com/tliron/turandot/releases) the latest binary release of
Turandot. Specifically you'll need the `turandot` CLI utility (it's a self-contained
executable).
Download the binary release of [Turandot](https://github.com/tliron/turandot/releases).
Specifically you'll need the `turandot` CLI utility (it's a self-contained executable).

You will also need the [Reposure](https://reposure.puccini.cloud/) CLI utility in
order to configure the registry that Turandot will use to store TOSCA service templates
Expand All @@ -36,6 +26,19 @@ Finally, we'll need the `puccini-csar` CLI utility from [Puccini](https://puccin
in order to package our CSAR. It's generally useful to have Puccini available in
order to validate and otherwise work with your TOSCA and CSAR.

A few other tools used by the scripts: `podman` (or `docker`), `pigz` (or `gzip`),
`zip`, `zipinfo`, `tar`.

### Kubernetes Cluster

To get started with Turandot you need `kubectl` access to a working Kubernetes
cluster.

For development work, [Minikube](https://minikube.sigs.k8s.io/docs/) is a quick way
to get started. Just make sure to start Minikube with its registry add-on enabled:

minikube start --addons=registry ...

The `turandot` and `reposure` utilities use the same local configuration you have for
`kubectl`, and like `kubectl` they can accept a `--namespace` argument for selecting
the namespace in which to work. To make commands more succinct in this guide let's set a
Expand Down Expand Up @@ -150,10 +153,6 @@ TOSCA artifact. The

examples/hello-world/scripts/save-container-image

The above script uses [Podman](https://podman.io/) to extract the tarball. If Podman is
not available to you, you can use Docker instead. Simply replace all `podman` commands
with `docker`.

Next you'll use the [build-csar](examples/hello-world/scripts/build-csar) script to package
the TOSCA topology template, profiles, and artifacts (including the container image
tarball you created above) into a CSAR:
Expand Down
16 changes: 14 additions & 2 deletions scripts/save-portable-container-image
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,21 @@ function goodbye () {
old_goodbye $1
}

if command -v podman &> /dev/null; then
PODMAN=podman
else
PODMAN=docker
fi

if command -v pigz &> /dev/null; then
GZIP=pigz
else
GZIP=gzip
fi

# Save
m "saving $IMAGE..."
podman save "$IMAGE" --output "$WORK/image.tar"
"$PODMAN" save "$IMAGE" --output "$WORK/image.tar"

# Unpack
m "unpacking..."
Expand All @@ -46,5 +58,5 @@ mv --force "$WORK/image/manifest.json~" "$WORK/image/manifest.json"
# Repack
m "repacking to $FILE..."
pushd "$WORK/image" > /dev/null
tar --create --use-compress-program=pigz --file="$FILE" *
tar --create --use-compress-program="$GZIP" --file="$FILE" *
popd > /dev/null

0 comments on commit 3291041

Please sign in to comment.