Skip to content

Instantly share code, notes, and snippets.

Created August 4, 2016 13:35
Show Gist options
  • Save anonymous/e70e4db47f18e2f6ef8e549890b4517e to your computer and use it in GitHub Desktop.
Save anonymous/e70e4db47f18e2f6ef8e549890b4517e to your computer and use it in GitHub Desktop.
FROM ubuntu:16.04
# Set correct environment variables.
ENV HOME /root
ENV PORT 2222
ENV HOSTNAME pair.dasapp.co
RUN apt-get update && apt-get install -y software-properties-common
# Use libssh 0.7 https://github.com/tmate-io/tmate/issues/82#issuecomment-216165761
RUN add-apt-repository ppa:kedazo/libssh-0.7.x
RUN apt-get update && \
apt-get -y install git-core build-essential pkg-config libtool libevent-dev libncurses-dev zlib1g-dev automake libssh-dev cmake ruby && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Use the latest msgpack-c https://github.com/tmate-io/tmate/issues/82#issuecomment-216165761
RUN git clone https://github.com/msgpack/msgpack-c.git && \
cd msgpack-c && \
cmake . && \
make && \
make install && \
cd ..
RUN git clone https://github.com/nviennot/tmate-slave.git /opt/tmate-slave
RUN cd /opt/tmate-slave && \
./create_keys.sh && \
./autogen.sh && \
./configure && \
make && \
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen && \
locale-gen && \
ldconfig
# Add the project scripts
COPY . /opt/tmate-slave
WORKDIR /opt/tmate-slave
CMD ["./message.sh"]
#RUN mkdir /etc/service/tmate-slave
#ADD tmate-slave.sh /etc/service/tmate-slave/run
#RUN mkdir -p /etc/my_init.d
#ADD message.sh /etc/my_init.d/message.sh
#!/bin/sh
DSA=`ssh-keygen -l -f /opt/tmate-slave/keys/ssh_host_dsa_key 2>&1 | cut -d\ -f 2`
RSA=`ssh-keygen -l -f /opt/tmate-slave/keys/ssh_host_rsa_key 2>&1 | cut -d\ -f 2`
ECDSA=`ssh-keygen -l -f /opt/tmate-slave/keys/ssh_host_ecdsa_key 2>&1 | cut -d\ -f 2`
echo Add this to your ~/.tmate.conf file
echo set -g tmate-server-host \"$HOSTNAME\"
echo set -g tmate-server-port \"$PORT\"
echo set -g tmate-server-rsa-fingerprint \"$RSA\"
echo set -g tmate-server-dsa-fingerprint \"$DSA\"
echo set -g tmate-server-ecdsa-fingerprint \"$ECDSA\"
echo set -g tmate-identity \"\" # Can be specified to use a different SSH key.
/opt/tmate-slave/tmate-slave -h $HOSTNAME -p $PORT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment