Skip to content

Commit

Permalink
docs: update demo with buildkit changes (#259)
Browse files Browse the repository at this point in the history
Co-authored-by: Xander Grzywinski <xandergrzyw@gmail.com>
  • Loading branch information
sozercan and salaxander committed Aug 21, 2023
1 parent fc01b26 commit ad8085c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
2 changes: 1 addition & 1 deletion demo/copa-demo-cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
clear

# Put your stuff here
pei "docker kill buildkitd"
pei "docker buildx rm copademo"
pei "docker rmi nginx:1.21.6-patched"
pei "docker rmi nginx:1.21.6"
pei "rm nginx.1.21.6.json"
23 changes: 8 additions & 15 deletions demo/copa-demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,23 @@
# hide the evidence
clear

# Put your stuff here

p "Pulling nginx:1.21.6 container image from DockerHub"
pei "docker pull nginx:1.21.6"
p "Use Trivy to output the number of vulnerabilities in the nginx:1.21.6 container image"
pei "trivy image --vuln-type os --ignore-unfixed nginx:1.21.6 | grep Total"

p "Use Trivy to scan the nginx:1.21.6 container image saving the output to nginx.1.21.6.json"
pei "trivy image --vuln-type os --ignore-unfixed -f json -o nginx.1.21.6.json nginx:1.21.6"

p "Use Trivy to output the number of vulnerabilities in the nginx:1.21.6 container image"
pei "trivy image --vuln-type os --ignore-unfixed nginx:1.21.6 | grep Total"

p "Run buildkit in a container locally, we'll need it to run copa"
pei "docker run --detach --rm --privileged -p 127.0.0.1:8888:8888/tcp --name buildkitd --entrypoint buildkitd moby/buildkit:v0.12.0 --addr tcp://0.0.0.0:8888"
p "Create a buildkit instance to connect to"
pei "docker buildx create --name copademo"

p "Confirm the buildkit container is running"
pei "docker ps"
p "List the buildkit instances"
pei "docker buildx ls"

p "Use copa to patch the nginx:1.21.6 container image outputting the patched container image to nginx:1.21.6-patched"
pei "copa patch -i docker.io/library/nginx:1.21.6 -r nginx.1.21.6.json -t 1.21.6-patched -a tcp://0.0.0.0:8888"
pei "copa patch -i docker.io/library/nginx:1.21.6 -r nginx.1.21.6.json -t 1.21.6-patched -a buildx://copademo"

p "Check that the nginx:1.21.6-patched container image is present locally"
pei "docker images"
pei "docker images | grep 1.21.6"

p "Use Trivy to scan the nginx:1.21.6-patched container image"
pei "trivy image --vuln-type os --ignore-unfixed nginx:1.21.6-patched | grep Total"
Expand All @@ -38,5 +33,3 @@ p "Verify that the patched container image runs"
pei "docker run nginx:1.21.6-patched"

p "Learn more about Copa at - https://github.com/project-copacetic/copacetic"


0 comments on commit ad8085c

Please sign in to comment.