This repository has been archived by the owner on Aug 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathDockerfile
78 lines (61 loc) · 2.87 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
75
76
77
78
FROM registry.access.redhat.com/ubi8/ubi
MAINTAINER OpenShift PSAP Team <openshift-psap@redhat.com>
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"
# Install openshift-ansible RPMs and some debugging tools
RUN yum install -y --quiet \
glibc-langpack-en \
go git make jq vim wget rsync time gettext \
python3 python3-devel python3-pip python3-setuptools && \
python3 -m pip install --no-cache-dir --quiet --upgrade setuptools pip wheel && \
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 --silent ${OCP_CLI_URL} | tar xfz - -C /usr/local/bin oc
# Install dependencies: `ocm`
ARG OCM_CLI_VERSION=v0.1.60
ARG OCM_CLI_URL=https://github.com/openshift-online/ocm-cli/releases/download/${OCM_CLI_VERSION}/ocm-linux-amd64
RUN curl --silent -L ${OCM_CLI_URL} --output /usr/local/bin/ocm
RUN chmod +x /usr/local/bin/ocm
# 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 --silent ${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 --silent -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}/
# Install Python requirements
RUN python3 -m pip install --quiet --no-cache-dir -r ${HOME}/requirements.txt && \
python3 -m pip install --quiet --no-cache-dir -r ${HOME}/subprojects/wdm/requirements.txt
# Prepare the CI `run` entrypoint
RUN echo -e '#!/usr/bin/env bash \n\
exec ${HOME}/testing/run "$@" \n\
' > /usr/local/bin/run; chmod ugo+x /usr/local/bin/run
# Ensure directory permissions are properly set
RUN mkdir -p ${HOME}/.ansible/tmp && chmod 777 ${HOME} -R
WORKDIR ${HOME}
ENTRYPOINT ["bash"]
CMD ["run"]