GNS3 Docker Images
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

50 lines
1.5 KiB

#!/bin/sh
# create a package list for every docker image in a "packages" directory
update_package_list()
{
# update package list if image is newer
# usage: update_package_list <image> <package list> <update command>
image=$1; shift
package_list=$1; shift
date_image=$(docker inspect --format='{{.Created}}' "$image")
[ -z "$date_image" ] && return 1
date_image=$(date -d "$date_image" +%s)
if [ -e "$package_list" ]; then
if [ ! -f "$package_list" ]; then
echo "$package_list: can't update, not a regular file" >&2
return 1
fi
[ "$(stat -c %Y "$package_list")" -ge "$date_image" ] && \
return 1
fi
if [ "$1" = "apk" ]; then
docker run --entrypoint "" --rm "$image" "$@" | LANG=C sort > "$package_list"
else
docker run --entrypoint "" --rm "$image" "$@" > "$package_list"
fi
}
mkdir -p packages
# Debian based base images
update_package_list debian:buster-slim packages/debian_buster dpkg -l
update_package_list ehlers/ipterm packages/ipterm dpkg -l
update_package_list ehlers/webterm packages/webterm dpkg -l
# Debian based images
grep -ilE '^FROM .*\b(debian|ipterm|webterm)' -- */Dockerfile | while read -r dockerfile; do
image=$(dirname "$dockerfile")
update_package_list "$image" "packages/$image" dpkg -l
done
# Alpine base image
update_package_list alpine packages/alpine apk list -q -I
# Alpine based images
grep -il '^FROM alpine' -- */Dockerfile | while read -r dockerfile; do
image=$(dirname "$dockerfile")
update_package_list "$image" "packages/$image" apk list -q -I
done