1
0
mirror of https://github.com/cloudflare/gortr.git synced 2024-05-19 06:50:10 +00:00

Docker and documentation update:

Updated README with more details on Docker and SSH
When creating a Docker container, generates an ECDSA key for SSH
This commit is contained in:
Louis Poinsignon
2019-04-11 14:25:14 -07:00
parent 384b634b81
commit 108bf84ebb
3 changed files with 43 additions and 0 deletions

View File

@ -11,6 +11,11 @@ COPY . .
RUN go build cmd/gortr/gortr.go
FROM alpine:latest as keygen
RUN apk --update --no-cache add openssl
RUN openssl ecparam -genkey -name prime256v1 -noout -outform pem > private.pem
FROM alpine:latest
ARG src_dir
@ -19,4 +24,5 @@ RUN apk --update --no-cache add ca-certificates && \
USER rtr
COPY --from=builder ${src_dir}/gortr ${src_dir}/cmd/gortr/cf.pub /
COPY --from=keygen /private.pem /private.pem
ENTRYPOINT ["./gortr"]

View File

@ -6,6 +6,11 @@ ARG src_uri
RUN apk --update --no-cache add git && \
go get -u $src_uri
FROM alpine:latest as keygen
RUN apk --update --no-cache add openssl
RUN openssl ecparam -genkey -name prime256v1 -noout -outform pem > private.pem
FROM alpine:latest
ARG src_uri
@ -15,4 +20,5 @@ USER rtr
COPY --from=builder /go/bin/gortr /
COPY cmd/gortr/cf.pub /
COPY --from=keygen /private.pem /private.pem
ENTRYPOINT ["./gortr"]

View File

@ -42,6 +42,37 @@ $ git clone git@github.com:cloudflare/gortr.git && cd gortr
$ go build cmd/gortr/gortr.go
```
## With Docker
If you do not want to use Docker, please go to the next section.
If you have **Docker**, you can start GoRTR with `docker run -ti -p 8082:8082 cloudflare/gortr`.
The containers contains Cloudflare's public signing key and an testing ECDSA private
key for the SSH server.
It will automatically download Cloudflare's prefix list and use the public key
to validate it.
You can now use any CLI attributes as long as they are after the image name:
```bash
$ docker run -ti -p 8083:8083 cloudflare/gortr -bind :8083
```
If you want to build your own image of GoRTR:
```bash
$ docker build -t mygortr -f Dockerfile.gortr.prod .
$ docker run -ti mygortr -h
```
It will download the code from GitHub and compile it with Go and also generate an ECDSA key for SSH.
Please note: if you plan to use SSH with Cloudflare's default container (`cloudflare/gortr`),
replace the key `private.pem` since it is a testing key that has been published.
An example is given below:
```bash
$ docker run -ti -v $PWD/mynewkey.pem:/private.pem cloudflare/gortr -ssh.bind :8083
```
## Install it
```bash