Added new all-in-one Dockerfile

Signed-off-by: Bala Raman <srbala@gmail.com>
This commit is contained in:
Bala Raman 2021-10-14 23:28:10 -04:00
parent 3019472862
commit a057c573cd
No known key found for this signature in database
GPG Key ID: 23A07BF21B5D6625
1 changed files with 74 additions and 0 deletions

74
Dockerfile.all-in-one Normal file
View File

@ -0,0 +1,74 @@
# ----------------------------------------------------------------------------
# Multi stage docker build for live cd tools in docker/container environment
# AlmaLinux Init + Live CD Tools + PyKickStart
# ----------------------------------------------------------------------------
FROM almalinux:8 as builder
RUN dnf install -y epel-release && \
# dnf upgrade -y && \
mkdir -p /mnt/system-root /mnt/system-root/build; \
dnf --nogpgcheck --repoid=BaseOS --repoid=AppStream --enablerepo=powertools --enablerepo="epel" \
--repofrompath='BaseOS,https://repo.almalinux.org/almalinux/8.5-beta/BaseOS/$basearch/kickstart/' \
--repofrompath='AppStream,https://repo.almalinux.org/almalinux/8.5-beta/AppStream/$basearch/kickstart/' \
# --repofrompath='powertools,https://repo.almalinux.org/almalinux/8/PowerTools/$basearch/kickstart/' \
install --installroot /mnt/system-root --releasever 8 --setopt=install_weak_deps=False --setopt=tsflags=nodocs -y \
bash \
dnf \
glibc-minimal-langpack \
anaconda-tui \
appliance-tools \
lorax \
subscription-manager \
jq \
tar \
policycoreutils \
pykickstart \
# Optional include to avoid runtime warning -- starts
libblockdev-mdraid \
libblockdev-crypto \
libblockdev-lvm \
libblockdev-dm \
libblockdev-swap \
libblockdev-loop \
libblockdev-nvdimm \
libblockdev-mpath \
# Optional include to avoid runtime warning -- ends
rootfiles \
util-linux-ng \
systemd \
livecd-tools \
pykickstart \
grub2-efi-*64 \
grub2-efi-*64-cdboot \
shim-*64 ; \
cp /etc/yum.repos.d/e* /mnt/system-root/etc/yum.repos.d/ ; \
/bin/date +%Y%m%d_%H%M > /mnt/system-root/etc/BUILDTIME ;\
# set DNF infra variable to container for compatibility with CentOS
echo 'container' > /mnt/system-root/etc/dnf/vars/infra; \
# install only en_US.UTF-8 locale files, see
# https://fedoraproject.org/wiki/Changes/Glibc_locale_subpackaging for details
echo '%_install_langs en_US.UTF-8' > /mnt/system-root/etc/rpm/macros.image-language-conf; \
echo 'LANG="C.utf8"' > /mnt/system-root/etc/locale.conf; \
touch /mnt/system-root/etc/machine-id; \
rm -rf /var/cache/yum;
#
COPY scripts/ /mnt/system-root/usr/bin
#
# Create Final image from scratch for ks2rootfs
FROM scratch
COPY --from=builder /mnt/system-root/ /
RUN systemctl mask \
dev-hugepages.mount \
systemd-logind.service \
getty.target \
console-getty.service \
systemd-machine-id-commit.service
WORKDIR /build
STOPSIGNAL SIGRTMIN+3
CMD ["/sbin/init"]
#ENTRYPOINT ["/bin/bash"]