ssh-deploy/test/Dockerfile

33 lines
735 B
Docker
Raw Normal View History

2022-12-29 22:14:51 +00:00
FROM nginx
2022-12-31 01:43:17 +00:00
ARG SSH_PUB_KEY
RUN apt update
2022-12-31 09:14:04 +00:00
RUN apt install openssh-server rsync sudo -y
2022-12-31 01:43:17 +00:00
RUN useradd -rm -d /home/test -s /bin/bash -g root -G sudo -u 1000 test
RUN usermod -aG sudo test
RUN echo "PubkeyAuthentication yes" >> /etc/ssh/sshd_config.d/pub.conf
RUN echo "AuthorizedKeysFile .ssh/authorized_keys" >> /etc/ssh/sshd_config.d/pub.conf
2022-12-31 09:17:50 +00:00
RUN mkdir -p /var/www/html
2022-12-31 01:43:17 +00:00
RUN mkdir -p /home/test/.ssh
RUN echo "$SSH_PUB_KEY" > /home/test/.ssh/authorized_keys
RUN chmod 700 /home/test/.ssh
RUN chown -R test /home/test/.ssh
RUN service ssh start
RUN echo 'test:test' | chpasswd
EXPOSE 22
ADD entrypoint.sh /docker-entrypoint.d/entrypoint.sh
RUN chmod +x /docker-entrypoint.d/entrypoint.sh
2022-12-30 13:29:31 +00:00
CMD ["nginx", "-g", "daemon off;"]