Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 1 addition & 29 deletions images/ansible-operator/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,46 +17,18 @@ COPY . .
RUN GOOS=linux GOARCH=$TARGETARCH make build/ansible-operator

# Final image.
# TODO(estroz): replace ubi image in FROM with the following base image once a build has occurred:
# FROM quay.io/operator-framework/ansible-operator-base:<tag>-<commit-ish>
FROM registry.access.redhat.com/ubi8/ubi:8.3-227
ARG TARGETARCH

RUN mkdir -p /etc/ansible \
&& echo "localhost ansible_connection=local" > /etc/ansible/hosts \
&& echo '[defaults]' > /etc/ansible/ansible.cfg \
&& echo 'roles_path = /opt/ansible/roles' >> /etc/ansible/ansible.cfg \
&& echo 'library = /usr/share/ansible/openshift' >> /etc/ansible/ansible.cfg
FROM quay.io/operator-framework/ansible-operator-base:v1.4.0-45-g65af4898a1cbeb032954979c68bba0d422454b6d

ENV HOME=/opt/ansible \
USER_NAME=ansible \
USER_UID=1001

# Install python dependencies after freshening metadata.
RUN dnf clean all && rm -rf /var/cache/dnf/* \
&& dnf update -y \
&& dnf install -y libffi-devel openssl-devel python38-devel gcc python38-pip python38-setuptools \
&& pip3 install --no-cache-dir \
cryptography==3.3.2 \
ansible-runner==1.3.4 \
ansible-runner-http==1.0.0 \
ipaddress==1.0.23 \
kubernetes==10.1.0 \
openshift==0.10.3 \
ansible==2.9.15 \
jmespath==0.10.0 \
&& dnf remove -y gcc libffi-devel openssl-devel python38-devel \
&& dnf clean all && rm -rf /var/cache/dnf/*

# Ensure directory permissions are properly set
RUN echo "${USER_NAME}:x:${USER_UID}:0:${USER_NAME} user:${HOME}:/sbin/nologin" >> /etc/passwd \
&& mkdir -p ${HOME}/.ansible/tmp \
&& chown -R ${USER_UID}:0 ${HOME} \
&& chmod -R ug+rwx ${HOME}

RUN curl -L -o /tini https://github.com/krallin/tini/releases/latest/download/tini-${TARGETARCH} \
&& chmod +x /tini

WORKDIR ${HOME}
USER ${USER_UID}

Expand Down