commit c0d2a0d240560c4923930e0a41bd18d112a0c582 Author: Marco Slater Date: Fri Mar 23 17:21:01 2018 +0000 Initial commit diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0a7bf73 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +FROM golang:latest + +RUN apt-get update && apt-get clean +RUN apt-get install jq -y && apt-get clean + +RUN curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh + +RUN wget -O release.tar.gz $(curl https://api.github.com/repos/shazow/ssh-chat/releases | jq .[0].zipball_url | sed -e s/\"//g -e s/zipball/tarball/g) + +RUN tar xvfz release.tar.gz && \ + mv shazow-ssh-chat-* /go/src/ssh-chat + +RUN cd /go/src/ssh-chat/ && \ + export GOPATH=/go && \ + make && \ + go build ./cmd/ssh-chat/ + +FROM debian:latest + +COPY entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh + +COPY --from=0 /go/src/ssh-chat/ssh-chat /ssh-chat + +ENTRYPOINT ["/entrypoint.sh"] diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..41354e5 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +if [ -f ssh_key ]; then + /ssh-chat -i /ssh_key $@ +else + echo "SSH Key not found at /ssh_key. Generating..." + apt-get update > /dev/null && apt-get install openssh-client -y > /dev/null 2>&1 + ssh-keygen -t rsa -b 4096 -f /ssh_key -q -N '' + /ssh-chat -i /ssh_key $@ +fi