Guest User

Untitled

a guest
Jan 16th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. ARG ssh_prv_key
  2. ARG ssh_pub_key
  3.  
  4. # Use an official Node runtime as a parent image
  5. FROM node:8.9.4
  6.  
  7. # Specify working directory in docker container
  8. WORKDIR /app
  9.  
  10. # Authorize SSH Host
  11. RUN mkdir -p /ssh/
  12. RUN chmod 0700 /ssh
  13.  
  14. # Add the keys and set permissions
  15. RUN echo "$ssh_prv_key" > /ssh/id_rsa && echo "$ssh_pub_key" > /ssh/id_rsa.pub && chmod 600 /ssh/id_rsa && chmod 600 /ssh/id_rsa.pub
  16.  
  17. # add bitbucket to known hosts
  18. RUN ssh-keyscan bitbucket.org > /ssh/known_hosts
  19.  
  20. # Copy SSH key to temp folder to pull new code
  21. # ADD ~/.ssh/id_rsa /tmp/
  22. # RUN ssh-agent /tmp
  23. RUN ls -la /ssh
  24.  
  25. # check if ssh agent is running or not, if not, run
  26. RUN eval `ssh-agent -s` && ssh-add /ssh/id_rsa
  27.  
  28. # Copy local files into the containers working directory
  29. COPY package.json /app
  30.  
  31. # Install dependencies inside container
  32. RUN npm i
  33.  
  34. # Copy local files into the containers working directory
  35. COPY . /app
  36.  
  37. # Execute Process
  38. CMD ["npm", "docker:rogers:local"]
  39.  
  40. # Remove ssh key from temp
  41. # RUN rm /tmp/id_rsa
  42. RUN rm -rf /ssh
  43.  
  44. # expose port
  45. EXPOSE 4200
Add Comment
Please, Sign In to add comment