Skip to content

Commit

Permalink
Added allrpc Dockerfile (#444)
Browse files Browse the repository at this point in the history
  • Loading branch information
TannerGabriel authored Mar 1, 2021
1 parent bfb62f8 commit cca2a9e
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
24 changes: 24 additions & 0 deletions cmd/signal/allrpc/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM golang:1.14.14-stretch

ENV GO111MODULE=on

WORKDIR $GOPATH/src/github.com/pion/ion-sfu

COPY go.mod go.sum ./
RUN cd $GOPATH/src/github.com/pion/ion-sfu && go mod download

COPY pkg/ $GOPATH/src/github.com/pion/ion-sfu/pkg
COPY cmd/ $GOPATH/src/github.com/pion/ion-sfu/cmd

WORKDIR $GOPATH/src/github.com/pion/ion-sfu/cmd/signal/allrpc
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o /sfu .

FROM alpine:3.12.3

RUN apk --no-cache add ca-certificates
COPY --from=0 /sfu /usr/local/bin/sfu

COPY config.toml /configs/sfu.toml

ENTRYPOINT ["/usr/local/bin/sfu"]
CMD ["-c", "/configs/sfu.toml"]
24 changes: 24 additions & 0 deletions cmd/signal/allrpc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,22 @@ func parse() bool {
help := flag.Bool("h", false, "help info")
flag.Parse()

if gaddr == "" {
gaddr = getEnv("gaddr")
}

if jaddr == "" {
jaddr = getEnv("jaddr")
}

if paddr == "" {
paddr = getEnv("paddr")
}

if maddr == "" {
maddr = getEnv("maddr")
}

// at least set one
if gaddr == "" && jaddr == "" {
return false
Expand All @@ -95,6 +111,14 @@ func parse() bool {
return true
}

func getEnv(key string) string {
if value, exists := os.LookupEnv(key); exists {
return value
}

return ""
}

func main() {
if !parse() {
showHelp()
Expand Down

0 comments on commit cca2a9e

Please sign in to comment.