1
0

Fix CentOS 8 image generator

This commit is contained in:
dump_stack() 2023-05-11 07:57:25 +00:00
parent e2e0dad1ad
commit 5f0749155a
Signed by: dump_stack
GPG Key ID: BE44DA8C062D87DC
2 changed files with 11 additions and 18 deletions

View File

@ -1,19 +1,9 @@
# Copyright 2020 Mikhail Klementev. All rights reserved.
# Use of this source code is governed by a AGPLv3 license
# (or later) that can be found in the LICENSE file.
#
# Usage:
#
# $ sudo docker build -t gen-centos8-image .
# $ sudo docker run --privileged -v $(pwd):/shared -t gen-centos8-image
# $ tar -Szcf out_of_tree_centos_8.img.tar.gz out_of_tree_centos_8.img
#
# out_of_tree_centos_8.img will be created in current directory.
# You can change $(pwd) to different directory to use different destination
# for image.
#
FROM centos:8 FROM centos:8
RUN sed -i 's/enabled=1/enabled=0/' /etc/yum.repos.d/* || true
RUN echo -e '[8.5.2111-os]\nbaseurl=https://vault.centos.org/8.5.2111/BaseOS/$basearch/os/\ngpgcheck=0' >> /etc/yum.repos.d/oot.repo
RUN echo -e '[8.5.2111-appstream]\nbaseurl=https://vault.centos.org/8.5.2111/AppStream/$basearch/os/\ngpgcheck=0' >> /etc/yum.repos.d/oot.repo
RUN yum -y update RUN yum -y update
RUN yum -y groupinstall "Development Tools" RUN yum -y groupinstall "Development Tools"
RUN yum -y install qemu-img e2fsprogs RUN yum -y install qemu-img e2fsprogs
@ -22,13 +12,13 @@ ENV TMPDIR=/tmp/centos
RUN yum --installroot=$TMPDIR \ RUN yum --installroot=$TMPDIR \
--releasever=8 \ --releasever=8 \
--disablerepo='*' \
--enablerepo=BaseOS \
-y groupinstall Base -y groupinstall Base
RUN rm $TMPDIR/etc/yum.repos.d/*
RUN cp /etc/yum.repos.d/* $TMPDIR/etc/yum.repos.d/
RUN yum --installroot=$TMPDIR \ RUN yum --installroot=$TMPDIR \
--releasever=8 \ --releasever=8 \
--disablerepo='*' \
--enablerepo=BaseOS \
-y install openssh-server openssh-clients -y install openssh-server openssh-clients
RUN chroot $TMPDIR /bin/sh -c 'useradd -m user' RUN chroot $TMPDIR /bin/sh -c 'useradd -m user'

View File

@ -1,4 +1,7 @@
#!/bin/sh #!/bin/sh
set -eux
cd "$(dirname "$0")" cd "$(dirname "$0")"
sudo docker build -t gen-centos8-image . sudo docker build -t gen-centos8-image .