-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathDockerfile.ubi
59 lines (41 loc) · 2.05 KB
/
Dockerfile.ubi
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
FROM registry.access.redhat.com/ubi8/ubi as build
RUN yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
RUN yum -y install \
bash gcc libffi-devel git gpgme-devel libxml2-devel \
libxslt-devel curl openssl-devel python3-devel unzip
RUN mkdir -p /opt/bin && mkdir /opt/aws
RUN curl -slL https://storage.googleapis.com/kubernetes-release/release/v1.18.3/bin/linux/amd64/kubectl \
-o kubectl && install kubectl /opt/bin/
RUN curl -slL https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/rosa/latest/rosa-linux.tar.gz \
-o rosa.tgz && tar xzvf rosa.tgz && install rosa /opt/bin/
RUN curl -slL https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip \
-o awscli.zip && unzip awscli.zip && aws/install -i /opt/aws -b /opt/bin
RUN groupadd ansible --g 1000 && useradd -s /bin/bash -g ansible -u 1000 ansible -d /home/ansible
USER ansible:ansible
RUN mkdir -p /ansible/virtualenv && chown -R ansible:ansible /ansible
WORKDIR /ansible
COPY ./requirements.txt /ansible/requirements.txt
RUN python3 -m venv /ansible/virtualenv
RUN /ansible/virtualenv/bin/python3 -m pip install --upgrade pip
RUN /ansible/virtualenv/bin/pip3 install -r /ansible/requirements.txt
FROM registry.access.redhat.com/ubi8/ubi-minimal
# # update the image
RUN microdnf --enablerepo=ubi-8-baseos -y install \
openssl unzip python3 \
shadow-utils \
&& microdnf clean all
RUN groupadd ansible --g 1000 && useradd -s /bin/bash -g ansible -u 1000 ansible -d /ansible
RUN mkdir -p ./virtualenv && chown -R ansible:ansible ./virtualenv
# # copy executables from build image
COPY --from=build /opt /opt
COPY --chown=ansible:ansible . /ansible
COPY --chown=ansible:ansible --from=build /ansible/virtualenv /ansible/virtualenv
USER ansible:ansible
# # set pathing
ENV PATH=/opt/bin:./virtualenv/bin:$PATH
ENV PYTHONPATH=./virtualenv/lib/python3.8/site-packages/
ENV ANSIBLE_PYTHON_INTERPRETER=./virtualenv/bin/python
# # set kubeconfig and ansible options
ENV KUBECONFIG=/ansible/.kube/config
ENV ANSIBLE_FORCE_COLOR=1
WORKDIR /ansible