Skip to content

Commit

Permalink
[CE-351]Add ansible agent image to docker hub
Browse files Browse the repository at this point in the history
Change-Id: I3b0448a91e29f8e996a49a7b3db58635b30f9b52
Signed-off-by: Tong Li <litong01@us.ibm.com>
  • Loading branch information
Tong Li committed May 8, 2018
1 parent e206242 commit e9ce9b7
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions dockerhub/latest/ansible-agent/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Dockerfile for hyperledger cello ansible agent
#
# @see https://github.com/hyperledger/cello/blob/master/docs/worker_ansible_howto.md
#
FROM alpine/git AS BUILD

RUN cd /tmp && git init cello && cd cello && \
git remote add origin https://github.com/hyperledger/cello.git && \
git config core.sparsecheckout true && \
echo "src/agent/ansible/*" >> .git/info/sparse-checkout && \
git pull --depth=1 origin master

FROM ubuntu:xenial

MAINTAINER Tong Li <litong01@us.ibm.com>

ARG user=ubuntu
ARG uid=1000
ARG gid=1000

RUN apt-get update && \
apt-get install -y bash sshpass python-pip openssh-client && \
pip install --upgrade pip ansible boto boto3 shade \
pyyaml openshift && \
groupadd -g ${gid} ${user} && \
useradd -d /opt/agent -u ${uid} -g ${user} ${user} && \
usermod -a -G root ${user} && \
mkdir -p /opt/agent/.ssh && \
cd /opt/agent/.ssh && \
echo "host *" > config && \
echo " StrictHostKeyChecking no" >> config && \
echo " UserKnownHostsFile /dev/null" >> config

COPY --from=build /tmp/cello/src/agent/ansible /opt/agent
RUN ssh-keygen -q -t rsa -N '' -f /opt/agent/vars/fd && \
chown -R ${uid}:${gid} /opt/agent && \
chmod 755 /opt/agent/entrypoint.sh

ENV HOME /opt/agent
ENV WORKDIR /opt/agent
WORKDIR /opt/agent
USER ${user}

ENTRYPOINT ["/opt/agent/entrypoint.sh"]
CMD [ "ansible-playbook", "--version" ]

0 comments on commit e9ce9b7

Please sign in to comment.