diff --git a/Dockerfile b/Dockerfile index 4c34f90..39af057 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,26 +1,29 @@ -FROM alpine:3.11 +FROM alpine:3.12 -ENV URL=http://localhost:5000 +ENV URL=http://localhost:8080 -ARG build_deps="go make dep" +ARG build_deps="go git" ARG runtime_deps="dumb-init" ARG user_id=1000 -COPY . /go/src/github.com/elisescu/tty-server +COPY . /go/src/github.com/elisescu/tty-proxy RUN apk update && \ apk add -u $build_deps $runtime_deps && \ - adduser -D -H -h / -u $user_id tty-server && \ - cd /go/src/github.com/elisescu/tty-server && \ - GOPATH=/go dep ensure && \ - GOPATH=/go make all && \ - cp tty-server /usr/bin/ && \ + adduser -D -H -h / -u $user_id tty-proxy + + +RUN cd /go/src/github.com/elisescu/tty-proxy && \ + GOPATH=/go go get github.com/go-bindata/go-bindata/... && \ + GOPATH=/go /go/bin/go-bindata --prefix static -o gobindata.go static/* && \ + GOPATH=/go go build && \ + cp tty-proxy /usr/bin/ && \ rm -r /go && \ apk del $build_deps -EXPOSE 5000 -EXPOSE 6543 -USER tty-server +EXPOSE 8080 +EXPOSE 3456 +USER tty-proxy ENTRYPOINT ["/usr/bin/dumb-init", "--"] -CMD ["/bin/sh", "-c", "/usr/bin/tty-server -web_address :5000 --sender_address :6543 -url $URL"] +CMD ["/bin/sh", "-c", "/usr/bin/tty-proxy --front-address :8080 --back-address :3456 -url $URL"] diff --git a/README.md b/README.md index 156322c..0634035 100644 --- a/README.md +++ b/README.md @@ -1,37 +1,36 @@ # tty-proxy +## Building the gobindata.go file + +All files under ~assets/*~ are packed to the gobindata.go file which will be statically compiled +within the final binary. + +```bash + go get github.com/go-bindata/go-bindata/... + go-bindata --prefix static -o gobindata.go static/* +``` ## Docker -The server can be built into a docker image as follows: +The `tty-proxy` can be built into a docker image as follows: - docker build -t tty-server . + docker build -t tty-proxy . -To run the container, type: +To run the container, type:p docker run \ - -p 6543:6543 -p 5000:5000 \ - -e URL=http://localhost:5000 \ + -p 3456:3456 -p 8080:8080 \ + -e URL=http://localhost:8080 \ --cap-drop=all --rm \ - tty-server + tty-proxy where you can replace `URL` by whatever will be the publicly visible URL of the server. After this, clients can be connected as follows: - tty-share -useTLS=false -server localhost:6543 + tty-share --tty-proxy localhost:3456 --no-tls --public -In the above command, 6543 is the default port where `tty-server` listens for -incoming shares (i.e. `tty-share` clients), and 5000 is the port of the web -interface through which remote users can connect. You can override the -defaults by specifying a different port mapping on the command line, e.g. -`-p 7654:6543 -p 80:5000` to listen on `7654` and serve on `80`. -## Building the gobindata.go file - -All files under ~assets/*~ are packed to the gobindata.go file which will be statically compiled -within the final binary. - -```bash - go get github.com/go-bindata/go-bindata/... - go-bindata --prefix static -o gobindata.go static/* -``` +In the above command, `:3456` is the default port where `tty-proxy` listens for incoming back +connections (i.e. `tty-share` clients), and 5000 is the port of the web interface through which +remote users can connect. You can override the defaults by specifying a different port mapping on +the command line, e.g. `-p 4567:3456 -p 80:8080` to listen on `4567` and serve on `80`.