Skip to content

Instantly share code, notes, and snippets.

@carlwgeorge
Created March 27, 2020 23:21
Show Gist options
  • Save carlwgeorge/44807e53debc1dcc31e4b476aed0ca3a to your computer and use it in GitHub Desktop.
Save carlwgeorge/44807e53debc1dcc31e4b476aed0ca3a to your computer and use it in GitHub Desktop.
#!/usr/bin/bash
set -xeou pipefail
BASE_IMAGE=registry.fedoraproject.org/fedora
BASE_TAG=31
NAME=f$BASE_TAG
DNFARGS='--setopt install_weak_deps=0 --assumeyes'
# base image
CONTAINER=$(buildah from --pull-always $BASE_IMAGE:${BASE_TAG})
# utils
buildah run $CONTAINER -- dnf $DNFARGS install python3-dnf-plugins-core
# dnf config
buildah run $CONTAINER -- sed --expression '/tsflags=nodocs/d' --in-place /etc/dnf/dnf.conf
buildah run $CONTAINER -- dnf config-manager --disable fedora-cisco-openh264
# update
buildah run $CONTAINER -- dnf $DNFARGS update
# install stuff
buildah run $CONTAINER -- dnf $DNFARGS install bash-completion dnf-utils findutils less man-db tree vim-enhanced wget
# clean up
buildah run $CONTAINER -- dnf clean all
buildah run $CONTAINER -- find /var/cache/dnf -mindepth 1 -delete
# shell config
buildah copy $CONTAINER bashrc /root/.bashrc
# save image
buildah commit $CONTAINER $NAME
buildah rm $CONTAINER
# create dnf cache volume
podman volume ls | grep -q $NAME-dnf-cache || podman volume create $NAME-dnf-cache
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment