File size: 1,768 Bytes
5965e93 | 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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | # ===============================
# Dockerfile untuk SSH + Ngrok
# ===============================
FROM ubuntu:22.04
# -------------------------------
# Set non-interactive agar apt tidak minta input
# -------------------------------
ENV DEBIAN_FRONTEND=noninteractive
# -------------------------------
# Update & Install tools
# -------------------------------
RUN apt update -y && apt install -y \
openssh-server \
wget \
unzip \
curl \
nano \
&& rm -rf /var/lib/apt/lists/*
# -------------------------------
# Buat direktori ssh
# -------------------------------
RUN mkdir /var/run/sshd
# -------------------------------
# Set password root
# -------------------------------
RUN echo 'root:123456' | chpasswd
# -------------------------------
# Konfigurasi SSH
# -------------------------------
RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config \
&& sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config
# -------------------------------
# Download & setup Ngrok
# -------------------------------
RUN wget -q -O /ngrok.zip https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-amd64.zip \
&& unzip /ngrok.zip -d /usr/local/bin \
&& chmod +x /usr/local/bin/ngrok \
&& rm /ngrok.zip
# -------------------------------
# Masukkan token Ngrok lewat ARG
# -------------------------------
ARG 3C0LPg1zjf8Ui52LQnfPnD8RYAp_Y8Ps2ghwf2yCNvhL7vit
RUN /usr/local/bin/ngrok config add-authtoken $NGROK_TOKEN
# -------------------------------
# Expose SSH port
# -------------------------------
EXPOSE 22
# -------------------------------
# Script startup
# -------------------------------
CMD service ssh start && \
/usr/local/bin/ngrok tcp 22 & |