Advertisement
Guest User

Untitled

a guest
Jul 7th, 2019
369
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. FROM node:10.15.0-stretch
  2. WORKDIR /usr/src/app
  3.  
  4. USER root
  5. RUN echo 'root:root' | chpasswd
  6.  
  7. # Install dependencies
  8. COPY package*.json ./
  9. RUN apt-get update
  10. RUN apt-get install -y openssh-server
  11.  
  12. RUN mkdir /var/run/sshd
  13. RUN sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config
  14. RUN echo 'PermitRootLogin=without-password' >> /etc/ssh/sshd_config
  15. # SSH login fix. Otherwise user is kicked off after login
  16. RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
  17. RUN sed -ie 's/#PermitUserEnvironment no/PermitUserEnvironment yes/g' /etc/ssh/sshd_config
  18. RUN sed -ir 's/#HostKey \/etc\/ssh\/ssh_host_rsa_key/HostKey \/etc\/ssh\/ssh_host_rsa_key/g' /etc/ssh/sshd_config
  19. RUN sed -ir 's/#HostKey \/etc\/ssh\/ssh_host_dsa_key/HostKey \/etc\/ssh\/ssh_host_dsa_key/g' /etc/ssh/sshd_config
  20. RUN sed -ir 's/#HostKey \/etc\/ssh\/ssh_host_ecdsa_key/HostKey \/etc\/ssh\/ssh_host_ecdsa_key/g' /etc/ssh/sshd_config
  21.  
  22. ## Suppress error message 'Could not load host key: ...'
  23. RUN rm -f /etc/ssh/ssh_host_rsa_key
  24. RUN rm -f /etc/ssh/ssh_host_dsa_key
  25. RUN rm -f /etc/ssh/ssh_host_ecdsa_key
  26. RUN ssh-keygen -q -N "" -t rsa -f /etc/ssh/ssh_host_rsa_key
  27. RUN ssh-keygen -q -N "" -t dsa -f /etc/ssh/ssh_host_dsa_key
  28. RUN ssh-keygen -q -N "" -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key
  29. RUN chmod 0444 /etc/ssh/*
  30.  
  31. ## Execute SSHD from entrypoint
  32. COPY entrypoint.sh /entrypoint.sh
  33. RUN chmod +x /entrypoint.sh
  34. ENTRYPOINT ["/entrypoint.sh"]
  35.  
  36. ## open ssh port
  37. EXPOSE 22
  38.  
  39. USER node
  40.  
  41. # Run
  42. CMD ["npm", "start"]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement