Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SSH support #2

Merged
merged 3 commits into from
May 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions container/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ENV DENO_VERSION=${DENO_VERSION}
ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get -qq update \
&& apt-get -qq install -y --no-install-recommends curl ca-certificates unzip \
&& apt-get -qq install -y --no-install-recommends curl ca-certificates unzip openssh-server \
&& curl -fsSL https://github.com/denoland/deno/releases/download/v${DENO_VERSION}/deno-x86_64-unknown-linux-gnu.zip \
--output deno.zip \
&& unzip deno.zip \
Expand All @@ -16,15 +16,21 @@ RUN apt-get -qq update \
&& apt-get -y -qq autoremove \
&& apt-get -qq clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& mkdir -p /home/site/wwwroot /opt/defaultsite
&& mkdir -p /home/site/wwwroot /opt/defaultsite \
echo "root:Docker!" | chpasswd

ENV DENO_DIR /deno-dir/
ENV PORT 80
EXPOSE 80
ENV SSH_PORT 2222
EXPOSE 80 2222

COPY sshd_config /etc/ssh/
RUN mkdir /var/run/sshd
RUN chmod 0755 /var/run/sshd

WORKDIR /home/site/wwwroot
COPY . /opt/defaultsite
RUN chmod +x /opt/defaultsite/startup.sh

ENTRYPOINT [ "/opt/defaultsite/startup.sh" ]
CMD ["deno", "run", "-A", "/opt/defaultsite/server.ts"]
CMD ["deno", "run", "-A", "/opt/defaultsite/server.ts"]
16 changes: 16 additions & 0 deletions container/sshd_config
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This is ssh server systemwide configuration file.
#
# /etc/sshd_config

Port SSH_PORT
ListenAddress 0.0.0.0
LoginGraceTime 180
X11Forwarding yes
Ciphers aes128-cbc,3des-cbc,aes256-cbc,aes128-ctr,aes192-ctr,aes256-ctr
MACs hmac-sha1,hmac-sha1-96
StrictModes yes
SyslogFacility DAEMON
PasswordAuthentication yes
PermitEmptyPasswords no
PermitRootLogin yes
Subsystem sftp internal-sftp
4 changes: 4 additions & 0 deletions container/startup.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/bin/bash
set -e

# starting sshd process
sed -i "s/SSH_PORT/$SSH_PORT/g" /etc/ssh/sshd_config
/usr/sbin/sshd

echo deno version `deno --version`
exec "$@"