Dockerfile.in 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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 _DOCKER_BASE_
  6. MAINTAINER Tong Li <litong01@us.ibm.com>
  7. ARG user=ubuntu
  8. ARG uid=1000
  9. ARG gid=1000
  10. RUN apt-get update && \
  11. apt-get install -y bash curl python-dev sshpass sudo \
  12. python-pip build-essential openssh-client libffi-dev \
  13. libssl-dev && \
  14. pip install --upgrade pip ansible boto boto3 shade \
  15. pyyaml && \
  16. groupadd -g ${gid} ${user} && \
  17. useradd -d /opt/agent -u ${uid} -g ${user} ${user} && \
  18. usermod -a -G root ${user} && \
  19. echo "${user} ALL=(ALL) NOPASSWD: ALL"|tee /etc/sudoers.d/${user} && \
  20. mkdir -p /opt/agent/.ssh && \
  21. cd /opt/agent/.ssh && \
  22. echo "host *" > config && \
  23. echo " StrictHostKeyChecking no" >> config && \
  24. echo " UserKnownHostsFile /dev/null" >> config
  25. ADD src/agent/ansible /opt/agent
  26. RUN ssh-keygen -q -t rsa -N '' -f /opt/agent/vars/fd && \
  27. chown -R ${uid}:${gid} /opt/agent && \
  28. chmod 755 /opt/agent/entrypoint.sh
  29. ENV HOME /opt/agent
  30. ENV WORKDIR /opt/agent
  31. WORKDIR /opt/agent
  32. USER ${user}
  33. ENTRYPOINT ["/opt/agent/entrypoint.sh"]
  34. CMD [ "ansible-playbook", "--version" ]