File Dockerfile of Package stack-validation
# Defines the tag for OBS and build script builds:
#!BuildTag: stack-validation:latest
FROM opensuse/tumbleweed
ARG USERNAME=ansible
ARG USER_UID=1000
ARG USER_GID=$USER_UID
# Install requirements
RUN zypper refresh && \
zypper -n in \
sudo \
coreutils \
findutils \
e2fsprogs \
sshpass \
shadow \
util-linux \
openssh-clients \
ansible-core \
python311 \
python311-kubernetes \
python311-netaddr \
python311-passlib \
python311-lxml \
dosfstools \
mtools \
bats \
podman \
sonobuoy \
kubernetes-client \
kubectl-node-shell \
python311-yamllint \
python311-python-gitlab \
python311-urllib3 \
python311-PyYAML \
awk \
yq \
helm \
ca-certificates-suse \
python311-junit2html \
python311-jinja2-ansible-filters \
python311-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/' /usr/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
# TODO: Remove those files "rm -Rf /etc/ansible/collections" doesn't seem to work