Commit c3663b89 authored by Kevin Daudt's avatar Kevin Daudt

add auxilary scripts that help managing images

parent aa468a96
Pipeline #118 passed with stage
in 21 seconds
FROM alpine:latest
RUN apk add --no-cache docker-cli
COPY scripts/ /usr/local/bin/
# docker-cli
Docker CLI tools based on Alpine.
## Helper scripts
### docker-push-image
Tags `<source_image>` as `<target_image>` and pushes it to the registry.
**Usage**:
docker-push-image <source_image> <target_image>
### docker-push-manifest
Creates and pushes a docker manifest based on multiple source images.
**Usage**:
```
docker-push-manifest <manifest> <image_prefix> <tag_suffix> <tag_suffix>..
<manifest> The name of the manifest to create and pushed
<image_prefix> The common prefix of each source image
<tag_prefix> One or more suffixes to that are used to specify the
source images
```
#!/bin/sh
if [ $? -lt 2 ]; then
echo "Usage: $0 <source_image> <target_image>"
exit 0
fi
source_image=$1
target_image=$2
docker tag "$source_image" "$target_image"
docker push "$target_image"
#!/bin/sh
if [ $? -lt 2 ]; then
echo "Usage: $0 <manifest> <image_prefix> <tag_suffixes>.."
exit 0
fi
manifest=$1
image_prefix=$2
shift 2;
if [ $? -lt 1 ]; then
echo "No tag suffixes supplied, nothing to do"
exit 1
fi
tag_suffixes="$@"
images=""
for tag_suffix in $tag_suffixes; do
image="$image_prefix$tag_suffix"
images="$images $image"
done
echo docker manifest create --amend "$manifest" $images
docker manifest create --amend "$manifest" $images
echo docker manifest push --purge "$manifest"
docker manifest push --purge "$manifest"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment