forked from net-ssh/net-ssh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
29 lines (20 loc) · 928 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
ARG RUBY_VERSION=3.1
FROM ruby:${RUBY_VERSION}
ARG BUNDLERV=
RUN apt update && apt install -y openssh-server sudo netcat-openbsd \
&& useradd --create-home --shell '/bin/bash' --comment 'NetSSH' 'net_ssh_1' \
&& useradd --create-home --shell '/bin/bash' --comment 'NetSSH' 'net_ssh_2' \
&& echo net_ssh_1:foopwd | chpasswd \
&& echo net_ssh_2:foo2pwd | chpasswd \
&& mkdir -p /home/net_ssh_1/.ssh \
&& mkdir -p /home/net_ssh_2/.ssh \
&& echo "net_ssh_1 ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \
&& echo "net_ssh_2 ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \
&& ssh-keygen -f /etc/ssh/users_ca -N ''
ENV INSTALL_PATH="/netssh"
WORKDIR $INSTALL_PATH
COPY Gemfile net-ssh.gemspec $INSTALL_PATH/
COPY lib/net/ssh/version.rb $INSTALL_PATH/lib/net/ssh/version.rb
RUN gem install bundler ${BUNDLERV} && bundle install
COPY . $INSTALL_PATH/
CMD service ssh start && rake test && NET_SSH_NO_ED25519=1 rake test