File Dockerfile of Package stack-validation-040-image

#!BuildTag: stack-validation:0.4.0
#!BuildVersion: 15.6

FROM opensuse/leap:15.6

ARG USERNAME=ansible
ARG USER_UID=1000
ARG USER_GID=$USER_UID

# Install requirements
RUN zypper refresh && \
    zypper -n install \
      sudo \
      coreutils \
      findutils \
      e2fsprogs \
      sshpass \
      shadow \
      util-linux \
      openssh-clients \
      ansible-core=2.16.5-bp156.2.3.1 \
      python3 \
      python3-kubernetes \
      python3-netaddr \
      python3-passlib \
      python3-lxml \
      dosfstools \
      mtools \
      bats \
      podman \
      sonobuoy \
      kubernetes-client \
      python3-yamllint \
      python3-python-gitlab \
      python3-urllib3 \
      python3-PyYAML \
      awk \
      git \
      jq \
      yq \
      helm \
      ca-certificates-suse \
      python3-junit2html \
      python311-jinja2-ansible-filters \
      python3-boto3 && \
    zypper clean -a

# Disable requiretty.
# https://lists.opensuse.org/archives/list/factory@lists.opensuse.org/thread/OAUAIGEWKJXBK2I6SEB4GLVJLXGZBPQQ/
RUN sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/'  /etc/sudoers

# Install Ansible inventory file
RUN mkdir -p /etc/ansible/collections && \
    echo -e '[local]\nlocalhost ansible_connection=local' > /etc/ansible/hosts && \
    chmod 777 /etc/ansible/collections

# Create the user
RUN groupadd --gid $USER_GID $USERNAME \
    && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
    && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
    && chmod 0440 /etc/sudoers.d/$USERNAME

USER $USERNAME

# Install collections required. There is no internet at build time so..
# TODO: Better process (create packages, etc.)
COPY --chown=$USERNAME:$USERNAME . /etc/ansible/collections/

# This must be executed on the folder where the collections are stored.
# https://docs.ansible.com/ansible/latest/collections_guide/collections_downloading.html
RUN pushd /etc/ansible/collections && \
    ansible-galaxy collection install -r requirements.yml && \
    popd
openSUSE Build Service is sponsored by