Browse Source

Adjust output formatting

master
Joe Taber 5 months ago
parent
commit
8f71fce660
  1. 15
      README.md
  2. 6
      docker-artifact.sh
  3. 4
      example/Dockerfile
  4. 11
      example/example.sh
  5. 1
      example/testfile.txt

15
README.md

@ -52,13 +52,14 @@ Options
> See the `example/` directory for a complete working example, summarized below:
```
> printf 'FROM busybox \n RUN mkdir app && echo "Hello World!" > /app/testfile.txt' | docker build -t infogulch/test-image -
...
> docker artifact label infogulch/test-image /app/testfile.txt
Successfully added labels to 'infogulch/test-image':
{
"/app/testfile.txt": "sha256:..."
}
> printf 'FROM busybox \n RUN mkdir app && echo "Hello World!" > /app/testfile.txt' | docker build -t infogulch/artifact-test -
=> [internal] load build definition from Dockerfile
...
=> => writing image sha256:bc8ff9e88a0908f50f3c39b640a2f5a39f6cb5b7bce60510673d5da4f3e6e704
=> => naming to docker.io/infogulch/artifact-test
> docker artifact label infogulch/artifact-test /app/testfile.txt
** Rebuilt image 'infogulch/artifact-test' to add 1 labels
** Run 'docker push infogulch/artifact-test' to push it to your container repository
> docker push infogulch/test-image
...
> docker artifact download infogulch/test-image /app/testfile.txt

6
docker-artifact.sh

@ -122,8 +122,8 @@ function label {
LOG "All image labels:"$'\n'"$(docker image inspect "$image" | jq '.[0].Config.Labels' | sed 's_^_ _' )"
# Remind user to push image
echo " [*] Rebuilt image '$image' to add $foundcount labels"
echo " [*] Run 'docker push $image' to push it to your container repository"
echo " ** Rebuilt image '$image' to add $foundcount labels"
echo " ** Run 'docker push $image' to push it to your container repository"
}
function delete_files {
@ -133,7 +133,7 @@ function delete_files {
export verbose=1
function LOG {
[ $verbose ] && >&2 echo -e "$(tput setaf 4) ==> $@$(tput sgr0)"
[ $verbose ] && >&2 echo -e "$(tput setaf 4) => $@$(tput sgr0)"
}
# Export functions used in subshells

4
example/Dockerfile

@ -1,4 +0,0 @@
FROM busybox
ADD testfile.txt .
RUN rm testfile.txt && mkdir app && echo "hello" > /app/othertestfile.txt

11
example/example.sh

@ -1,16 +1,13 @@
#!/usr/bin/env bash
set -e
source=$(dirname "${BASH_SOURCE[0]}")
pushd "$source" &> /dev/null
pushd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null
# Build example image
echo "Rebuilding docker image for example"
docker build . -t infogulch/test-image &> /dev/null
printf 'FROM busybox \n RUN mkdir app && echo "Hello World!" > /app/testfile.txt' | docker build -t infogulch/artifact-test - &> /dev/null
# Execute docker artifact to add a label to /app/othertestfile.txt
set +e
../docker-artifact.sh artifact label infogulch/test-image /app/othertestfile.txt
# Execute docker artifact to add a label that identifies /app/testfile.txt
../docker-artifact.sh artifact label infogulch/artifact-test /app/testfile.txt
popd &> /dev/null

1
example/testfile.txt

@ -1 +0,0 @@
hi
Loading…
Cancel
Save