forked from openshift-psap/ci-artifacts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
74 lines (57 loc) · 2.54 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
FROM registry.access.redhat.com/ubi8/ubi
MAINTAINER OpenShift PSAP Team <[email protected]>
LABEL io.k8s.display-name="OpenShift PSAP CI artifacts" \
io.k8s.description="An image for running Ansible artifacts for OpenShift PSAP CI" \
name="ci-artifacts" \
url="https://github.com/openshift-psap/ci-artifacts"
# Add image scripts and files for running as a system container
COPY build/root /
# Install openshift-ansible RPMs and some debugging tools
RUN yum install -y \
glibc-langpack-en \
go git make jq vim wget rsync \
python3 python3-devel python3-pip python3-setuptools && \
python3 -m pip install --no-cache-dir --upgrade setuptools pip wheel && \
python3 -m pip install --no-cache-dir \
openshift \
yq \
ansible==2.9.* && \
yum clean all && \
rm -rf $HOME/.cache && \
rm -rf /var/cache/yum
# Install dependencies: `oc`
ARG OCP_CLI_VERSION=latest
ARG OCP_CLI_URL=https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp/${OCP_CLI_VERSION}/openshift-client-linux.tar.gz
RUN curl ${OCP_CLI_URL} | tar xfz - -C /usr/local/bin oc
# Install dependencies: `helm`
ARG HELM_VERSION=v3.5.1
ARG HELM_URL=https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz
RUN curl ${HELM_URL} | tar xfz - -C /usr/local/bin --strip-components 1 linux-amd64/helm
# Install dependencies: `operator-sdk`
ARG OPERATOR_SDK_VERSION=v1.6.2
ARG OPERATOR_SDK_URL=https://github.com/operator-framework/operator-sdk/releases/download/${OPERATOR_SDK_VERSION}
RUN cd /usr/local/bin \
&& curl -LO ${OPERATOR_SDK_URL}/operator-sdk_linux_amd64 \
&& mv operator-sdk_linux_amd64 operator-sdk \
&& chmod +x operator-sdk
# Set up Ansible
RUN mkdir -p /etc/ansible \
&& echo "localhost ansible_connection=local" > /etc/ansible/hosts
COPY config/ansible.cfg /etc/ansible/ansible.cfg
COPY config/inventory/hosts /etc/ansible/inventory/hosts
RUN sed -i 's|roles/|/opt/ci-artifacts/roles/|' /etc/ansible/ansible.cfg \
&& sed -i 's|callback_plugins = ../|callback_plugins = /opt/ci-artifacts/src/|' /etc/ansible/ansible.cfg
# Set up the runner user
ENV USER_NAME=psap-ci-runner \
USER=psap-ci-runner \
HOME=/opt/ci-artifacts/src/ \
ANSIBLE_CONFIG="/etc/ansible/ansible.cfg" \
INSIDE_CI_IMAGE="y"
COPY . ${HOME}/
# Prepare the image for must-gather support
RUN mkdir /must-gather && chmod 777 /must-gather
# Prepare the GPU-operator's gather script
RUN ln -s ${HOME}/toolbox/gpu-operator/must-gather.sh /usr/bin/gpu-operator_gather
# Ensure directory permissions are properly set
RUN mkdir -p ${HOME}/.ansible/tmp && chmod 777 ${HOME} -R
WORKDIR ${HOME}