|
| 1 | +# Dockerfile for hyperledger cello ansible agent |
| 2 | +# |
| 3 | +# @see https://github.com/hyperledger/cello/blob/master/docs/worker_ansible_howto.md |
| 4 | +# |
| 5 | +FROM alpine/git AS BUILD |
| 6 | + |
| 7 | +RUN cd /tmp && git init cello && cd cello && \ |
| 8 | + git remote add origin https://github.com/hyperledger/cello.git && \ |
| 9 | + git config core.sparsecheckout true && \ |
| 10 | + echo "src/agent/ansible/*" >> .git/info/sparse-checkout && \ |
| 11 | + git pull --depth=1 origin master |
| 12 | + |
| 13 | +FROM ubuntu:xenial |
| 14 | + |
| 15 | +MAINTAINER Tong Li <litong01@us.ibm.com> |
| 16 | + |
| 17 | +ARG user=ubuntu |
| 18 | +ARG uid=1000 |
| 19 | +ARG gid=1000 |
| 20 | + |
| 21 | +RUN apt-get update && \ |
| 22 | + apt-get install -y bash sshpass python-pip openssh-client && \ |
| 23 | + pip install --upgrade pip ansible boto boto3 shade \ |
| 24 | + pyyaml openshift && \ |
| 25 | + groupadd -g ${gid} ${user} && \ |
| 26 | + useradd -d /opt/agent -u ${uid} -g ${user} ${user} && \ |
| 27 | + usermod -a -G root ${user} && \ |
| 28 | + mkdir -p /opt/agent/.ssh && \ |
| 29 | + cd /opt/agent/.ssh && \ |
| 30 | + echo "host *" > config && \ |
| 31 | + echo " StrictHostKeyChecking no" >> config && \ |
| 32 | + echo " UserKnownHostsFile /dev/null" >> config |
| 33 | + |
| 34 | +COPY --from=build /tmp/cello/src/agent/ansible /opt/agent |
| 35 | +RUN ssh-keygen -q -t rsa -N '' -f /opt/agent/vars/fd && \ |
| 36 | + chown -R ${uid}:${gid} /opt/agent && \ |
| 37 | + chmod 755 /opt/agent/entrypoint.sh |
| 38 | + |
| 39 | +ENV HOME /opt/agent |
| 40 | +ENV WORKDIR /opt/agent |
| 41 | +WORKDIR /opt/agent |
| 42 | +USER ${user} |
| 43 | + |
| 44 | +ENTRYPOINT ["/opt/agent/entrypoint.sh"] |
| 45 | +CMD [ "ansible-playbook", "--version" ] |
0 commit comments