49 lines
1.5 KiB
Docker
49 lines
1.5 KiB
Docker
FROM oraclelinux:_VERSION_
|
|
|
|
RUN yum -y update
|
|
RUN yum -y groupinstall "Development Tools"
|
|
RUN yum -y install qemu-img e2fsprogs
|
|
|
|
ENV TMPDIR=/tmp/oraclelinux
|
|
|
|
RUN sed -i 's/$ociregion//' /etc/yum.repos.d/*
|
|
RUN sed -i 's/$ocidomain/oracle.com/' /etc/yum.repos.d/*
|
|
|
|
RUN yum --installroot=$TMPDIR \
|
|
--releasever=_VERSION_ \
|
|
--disablerepo='*' \
|
|
--enablerepo=ol_VERSION__baseos_latest \
|
|
-y groupinstall Base
|
|
|
|
RUN cp /etc/yum.repos.d/* $TMPDIR/etc/yum.repos.d/
|
|
|
|
RUN yum --installroot=$TMPDIR \
|
|
--releasever=_VERSION_ \
|
|
--disablerepo='*' \
|
|
--enablerepo=ol_VERSION__baseos_latest \
|
|
-y install openssh-server openssh-clients dhclient yum
|
|
|
|
RUN chroot $TMPDIR /bin/sh -c 'useradd -m user'
|
|
RUN sed -i 's/root:\*:/root::/' $TMPDIR/etc/shadow
|
|
RUN sed -i 's/user:!!:/user::/' $TMPDIR/etc/shadow
|
|
RUN sed -i '/PermitEmptyPasswords/d' $TMPDIR/etc/ssh/sshd_config
|
|
RUN echo PermitEmptyPasswords yes >> $TMPDIR/etc/ssh/sshd_config
|
|
RUN sed -i '/PermitRootLogin/d' $TMPDIR/etc/ssh/sshd_config
|
|
RUN echo PermitRootLogin yes >> $TMPDIR/etc/ssh/sshd_config
|
|
|
|
# network workaround
|
|
RUN chmod +x $TMPDIR/etc/rc.local
|
|
RUN echo 'dhclient' >> $TMPDIR/etc/rc.local
|
|
|
|
ENV IMAGEDIR=/tmp/image
|
|
ENV IMAGE=/shared/out_of_tree_oraclelinux__VERSION_.img
|
|
|
|
RUN mkdir $IMAGEDIR
|
|
|
|
# Must be executed with --privileged because of /dev/loop
|
|
CMD qemu-img create $IMAGE 4G && \
|
|
mkfs.ext4 -F $IMAGE && \
|
|
mount -o loop $IMAGE $IMAGEDIR && \
|
|
cp -a $TMPDIR/* $IMAGEDIR/ && \
|
|
umount $IMAGEDIR
|