| # =============================== | |
| # 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 & |