lib/kitchen/docker/helpers/dockerfile_helper.rb in kitchen-docker-2.13.0 vs lib/kitchen/docker/helpers/dockerfile_helper.rb in kitchen-docker-2.14.0

- old
+ new

@@ -32,14 +32,16 @@ gentoo_platform when 'gentoo-paludis' gentoo_paludis_platform when 'opensuse/tumbleweed', 'opensuse/leap', 'opensuse', 'sles' opensuse_platform - when 'rhel', 'centos', 'oraclelinux', 'amazonlinux', 'almalinux', 'rockylinux' + when 'rhel', 'centos', 'oraclelinux', 'amazonlinux', 'rockylinux' rhel_platform when 'centosstream' centosstream_platform + when 'almalinux' + almalinux_platform when 'photon' photonos_platform else raise ActionFailed, "Unknown platform '#{config[:platform]}'" end @@ -126,10 +128,20 @@ RUN [ -f "/etc/ssh/ssh_host_rsa_key" ] || ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N '' RUN [ -f "/etc/ssh/ssh_host_dsa_key" ] || ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N '' CODE end + def almalinux_platform + <<-CODE + ENV container docker + RUN yum clean all + RUN yum install -y sudo openssh-server openssh-clients which + RUN [ -f "/etc/ssh/ssh_host_rsa_key" ] || ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N '' + RUN [ -f "/etc/ssh/ssh_host_dsa_key" ] || ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N '' + CODE + end + def photonos_platform <<-CODE ENV container docker RUN tdnf clean all RUN tdnf install -y sudo openssh-server openssh-clients which curl @@ -141,9 +153,11 @@ def dockerfile_base_linux(username, homedir) <<-CODE RUN if ! getent passwd #{username}; then \ useradd -d #{homedir} -m -s /bin/bash -p '*' #{username}; \ fi + RUN mkdir -p /etc/sudoers.d + RUN chmod 0750 /etc/sudoers.d RUN echo "#{username} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/#{username} RUN echo "Defaults !requiretty" >> /etc/sudoers.d/#{username} RUN mkdir -p #{homedir}/.ssh RUN chown -R #{username} #{homedir}/.ssh RUN chmod 0700 #{homedir}/.ssh