Skip to content
This repository was archived by the owner on Feb 29, 2024. It is now read-only.

Commit 108bf84

Browse files
committed
Docker and documentation update:
Updated README with more details on Docker and SSH When creating a Docker container, generates an ECDSA key for SSH
1 parent 384b634 commit 108bf84

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed

Dockerfile.gortr

+6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ COPY . .
1111

1212
RUN go build cmd/gortr/gortr.go
1313

14+
FROM alpine:latest as keygen
15+
16+
RUN apk --update --no-cache add openssl
17+
RUN openssl ecparam -genkey -name prime256v1 -noout -outform pem > private.pem
18+
1419
FROM alpine:latest
1520
ARG src_dir
1621

@@ -19,4 +24,5 @@ RUN apk --update --no-cache add ca-certificates && \
1924
USER rtr
2025

2126
COPY --from=builder ${src_dir}/gortr ${src_dir}/cmd/gortr/cf.pub /
27+
COPY --from=keygen /private.pem /private.pem
2228
ENTRYPOINT ["./gortr"]

Dockerfile.gortr.prod

+6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ ARG src_uri
66
RUN apk --update --no-cache add git && \
77
go get -u $src_uri
88

9+
FROM alpine:latest as keygen
10+
11+
RUN apk --update --no-cache add openssl
12+
RUN openssl ecparam -genkey -name prime256v1 -noout -outform pem > private.pem
13+
914
FROM alpine:latest
1015
ARG src_uri
1116

@@ -15,4 +20,5 @@ USER rtr
1520

1621
COPY --from=builder /go/bin/gortr /
1722
COPY cmd/gortr/cf.pub /
23+
COPY --from=keygen /private.pem /private.pem
1824
ENTRYPOINT ["./gortr"]

README.md

+31
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,37 @@ $ git clone [email protected]:cloudflare/gortr.git && cd gortr
4242
$ go build cmd/gortr/gortr.go
4343
```
4444

45+
## With Docker
46+
47+
If you do not want to use Docker, please go to the next section.
48+
49+
If you have **Docker**, you can start GoRTR with `docker run -ti -p 8082:8082 cloudflare/gortr`.
50+
The containers contains Cloudflare's public signing key and an testing ECDSA private
51+
key for the SSH server.
52+
53+
It will automatically download Cloudflare's prefix list and use the public key
54+
to validate it.
55+
56+
You can now use any CLI attributes as long as they are after the image name:
57+
```bash
58+
$ docker run -ti -p 8083:8083 cloudflare/gortr -bind :8083
59+
```
60+
61+
If you want to build your own image of GoRTR:
62+
```bash
63+
$ docker build -t mygortr -f Dockerfile.gortr.prod .
64+
$ docker run -ti mygortr -h
65+
```
66+
It will download the code from GitHub and compile it with Go and also generate an ECDSA key for SSH.
67+
68+
Please note: if you plan to use SSH with Cloudflare's default container (`cloudflare/gortr`),
69+
replace the key `private.pem` since it is a testing key that has been published.
70+
An example is given below:
71+
72+
```bash
73+
$ docker run -ti -v $PWD/mynewkey.pem:/private.pem cloudflare/gortr -ssh.bind :8083
74+
```
75+
4576
## Install it
4677

4778
```bash

0 commit comments

Comments
 (0)