2021-11-17 00:27:39 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# base vars
|
|
|
|
NOW=$(date +%s) # epoch timestamp, eg: 1622772927
|
|
|
|
BASE_TAG=$(awk '$1 == "FROM" {print $2}' Dockerfile | cut -d\: -f2) # eg: 2.7.1
|
|
|
|
BUILD_TAG="fedora-${BASE_TAG}-${NOW}"
|
|
|
|
IMAGE_FILE="steamcmd-${BUILD_TAG}.img"
|
|
|
|
|
|
|
|
echo "Building image steamcmd:${BUILD_TAG}"
|
|
|
|
podman build --tag steamcmd:${BUILD_TAG} .
|
|
|
|
podman save localhost/steamcmd:${BUILD_TAG} > ${IMAGE_FILE}
|
|
|
|
echo ""
|
|
|
|
echo "Wrote ${IMAGE_FILE}, cleaning up"
|
|
|
|
podman rmi steamcmd:${BUILD_TAG}
|
2021-11-17 01:39:21 +00:00
|
|
|
echo ""
|
2021-11-17 00:27:39 +00:00
|
|
|
echo "Attempting to compress the image (begin comforting music)"
|
|
|
|
xz --keep --compress -9 --extreme --threads=$(nproc) ${IMAGE_FILE}
|
|
|
|
echo ""
|
|
|
|
echo "Finished, (non)compressed images created:"
|
2021-11-17 01:39:21 +00:00
|
|
|
ls --color=auto -lah ${IMAGE_FILE}*
|