-
Notifications
You must be signed in to change notification settings - Fork 14
/
Dockerfile
68 lines (46 loc) · 2.07 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
#
# BUILD
#
FROM fedora:33 as build
ENV HOME=/home/ansible
RUN dnf -y install \
bash gcc musl-devel libffi-devel git gpgme-devel libxml2-devel \
libxslt-devel curl cargo openssl-devel python-devel unzip
RUN groupadd ansible --g 1000 && useradd -s /bin/bash -g ansible -u 1000 ansible -d ${HOME}
RUN mkdir -p /ansible/virtualenv && chown -R ansible:ansible /ansible
USER ansible:ansible
RUN mkdir -p ${HOME}/.local/bin
WORKDIR /ansible
# add other executables
RUN curl -slL https://storage.googleapis.com/kubernetes-release/release/v1.18.3/bin/linux/amd64/kubectl \
-o kubectl && install kubectl ${HOME}/.local/bin/
RUN curl -slL https://github.com/openshift/rosa/releases/download/v1.1.0/rosa-linux-amd64 \
-o rosa && install rosa ${HOME}/.local/bin/
RUN curl -slL https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip \
-o awscli.zip && unzip awscli.zip && aws/install -i ${HOME}/.local/aws-cli -b /ansible/.local/bin
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
COPY . /ansible
FROM fedora:33
ENV HOME=/home/ansible
# # update the image
RUN dnf -y install \
bash openssl unzip glibc groff
RUN groupadd ansible --g 1000 && useradd -s /bin/bash -g ansible -u 1000 ansible -d ${HOME}
RUN mkdir -p /ansible/virtualenv && chown -R ansible:ansible /ansible
# # copy executables from build image
# COPY --from=build /usr/local/bin /usr/local/bin
COPY --chown=ansible:ansible . /ansible
COPY --chown=ansible:ansible --from=build ${HOME}/.local ${HOME}/.local
COPY --chown=ansible:ansible --from=build /ansible/virtualenv /ansible/virtualenv
USER ansible:ansible
# # set pathing
ENV PATH=${HOME}/.local/bin:./virtualenv/bin:/ansible/staging/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/staging/.kube/config
ENV ANSIBLE_FORCE_COLOR=1
WORKDIR /ansible