Skip to content

Instantly share code, notes, and snippets.

@xocasdashdash
Created February 9, 2020 18:26
Show Gist options
  • Save xocasdashdash/2be71f770e4908427e4fa1c494c171ef to your computer and use it in GitHub Desktop.
Save xocasdashdash/2be71f770e4908427e4fa1c494c171ef to your computer and use it in GitHub Desktop.
With Openstack and Python Consul
FROM python:3.7-slim as BUILDER
RUN apt-get update && apt-get install -y --no-install-recommends gcc python-dev && \
pip install netifaces==0.10.9
FROM python:3.7-slim as RUNNER
# Set Workdir
WORKDIR /ansible
# Define volumes
VOLUME [ "/ansible" ]
# Install ansible
ARG ANSIBLE_VERSION=2.9.0
COPY --from=BUILDER /usr/local/lib/python3.7/site-packages/netifaces.cpython-37m-x86_64-linux-gnu.so /usr/local/lib/python3.7/site-packages/netifaces.cpython-37m-x86_64-linux-gnu.so
COPY --from=BUILDER /usr/local/lib/python3.7/site-packages/netifaces-0.10.9.dist-info /usr/local/lib/python3.7/site-packages/netifaces-0.10.9.dist-info
RUN apt-get update && \
apt-get install -y --no-install-recommends openssh-client sshpass && \
pip install ansible==${ANSIBLE_VERSION} openstacksdk python-consul2 && \
apt autoremove -y && rm -rf /var/lib/apt/lists/* && \
rm -rf /root/.cache && \
find /usr/local/lib/python3.7 -type f -name *.pyc -delete
ADD certs/ /usr/local/share/ca-certificates/certs/
RUN update-ca-certificates --verbose --fresh
ENV REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
CMD [ "ansible", "--version" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment