|
|
@ -112,35 +112,40 @@ done |
|
|
|
### export BUILDAH_FORMAT=docker |
|
|
|
|
|
|
|
# build image |
|
|
|
echo "Building image ..." |
|
|
|
echo "Building image tmp-$epoch ..." |
|
|
|
podman build -f Containerfile -t tmp-$epoch $buildopts |
|
|
|
|
|
|
|
# Initfile is for commands that need systemd to execute |
|
|
|
if [[ -f Initfile ]]; then |
|
|
|
echo "Running initialization ..." |
|
|
|
echo "Creating temporary container ..." |
|
|
|
echo "Creating temporary container tmp-$epoch ..." |
|
|
|
podman create --name tmp-$epoch $runopts tmp-$epoch |
|
|
|
podman start tmp-$epoch |
|
|
|
echo "Copying script to container ..." |
|
|
|
echo "Copying script to container tmp-$epoch ..." |
|
|
|
podman cp Initfile tmp-$epoch:/root/ |
|
|
|
echo "Running script ..." |
|
|
|
echo "Running Initfile script ..." |
|
|
|
podman exec tmp-$epoch bash -c "chmod +x /root/Initfile && /root/Initfile" |
|
|
|
echo "Committing container to image ..." |
|
|
|
echo "Committing container tmp-$epoch to image $name:$today ..." |
|
|
|
podman commit tmp-$epoch "$name:$today" |
|
|
|
else |
|
|
|
echo "Initfile not found, skipping temporary container step ..." |
|
|
|
# tag image we already built with appropriate tag, and untag with tmp |
|
|
|
echo "Tagging image tmp-$epoch as $name:$today ..." |
|
|
|
podman tag tmp-$epoch "$name:$today" |
|
|
|
podman rmi tmp-$epoch |
|
|
|
fi |
|
|
|
|
|
|
|
echo "Removing temporary image tmp-$epoch ..." |
|
|
|
podman rmi tmp-$epoch |
|
|
|
|
|
|
|
# tag image as latest |
|
|
|
echo "Adding latest tag to image $name:$today ..." |
|
|
|
podman tag "$name:$today" "$name:latest" |
|
|
|
|
|
|
|
# assign any extra tags |
|
|
|
for tag in "${opt_tags[@]}"; do |
|
|
|
echo "Adding tag $tag to image $name:$today ..." |
|
|
|
podman tag "$name:$today" "$name:$tag" |
|
|
|
done |
|
|
|
|
|
|
|
echo "Done!" |
|
|
|
echo "... Done!" |
|
|
|
|
|
|
|