Skip to content

Instantly share code, notes, and snippets.

@carlwgeorge
Created March 9, 2020 20:29
Show Gist options
  • Save carlwgeorge/79ff40196fa39538119ccad36054b6d6 to your computer and use it in GitHub Desktop.
Save carlwgeorge/79ff40196fa39538119ccad36054b6d6 to your computer and use it in GitHub Desktop.
#!/usr/bin/bash
set -xeou pipefail
DNFARGS='--setopt install_weak_deps=0 --assumeyes'
# base image
CONTAINER=$(buildah from --pull-always centos:8)
# utils
buildah run $CONTAINER -- dnf $DNFARGS install dnf-utils
# dnf config
buildah run $CONTAINER -- dnf $DNFARGS install centos-release-stream
buildah run $CONTAINER -- dnf config-manager --disable BaseOS --disable AppStream --disable extras
# update
buildah run $CONTAINER -- dnf $DNFARGS update
# epel
#buildah run $CONTAINER -- dnf --assumeyes install epel-release
#buildah run $CONTAINER -- rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8
# install stuff
buildah run $CONTAINER -- dnf $DNFARGS install bash-completion 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 c8s:latest
buildah rm $CONTAINER
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment