mirror of
https://github.com/easingthemes/ssh-deploy.git
synced 2025-06-21 12:02:09 +10:00
test
This commit is contained in:
parent
fd8e654d7e
commit
aeee708bee
6 changed files with 85 additions and 49 deletions
|
@ -1,15 +1,31 @@
|
|||
FROM nginx
|
||||
# Set args to get from Gtihub Action
|
||||
ARG ssh_pub_key
|
||||
ARG ssh_user
|
||||
# Add a user to the container
|
||||
RUN adduser --disabled-password $ssh_user
|
||||
# USER $ssh_user
|
||||
# Add the ssh public key to the container
|
||||
RUN mkdir -p /home/$ssh_user/.ssh
|
||||
RUN echo "$ssh_pub_key" > /home/$ssh_user/.ssh/authorized_keys
|
||||
RUN chmod 700 /home/$ssh_user/.ssh
|
||||
# Start server
|
||||
EXPOSE 80
|
||||
STOPSIGNAL SIGTERM
|
||||
|
||||
ARG SSH_PUB_KEY
|
||||
|
||||
RUN apt update
|
||||
|
||||
RUN apt install openssh-server sudo -y
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
|
|
3
test/entrypoint.sh
Normal file
3
test/entrypoint.sh
Normal file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
/usr/sbin/sshd -D
|
Loading…
Add table
Add a link
Reference in a new issue