diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..8f976e7 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +* +# exluding everything and only allowing directly relevant stuff +!cmd/server/main.go +!internal +!tokens +!go.mod +!go.sum +!server diff --git a/.gitignore b/.gitignore index f50a924..3006fab 100644 --- a/.gitignore +++ b/.gitignore @@ -17,9 +17,10 @@ # vendor/ # binaries -bin/* +bin *.tar.gz # logs *.log tokens +logs diff --git a/Dockerfile.server b/Dockerfile.server index b09f64a..f21a8c8 100644 --- a/Dockerfile.server +++ b/Dockerfile.server @@ -1,5 +1,5 @@ # syntax=docker/dockerfile:1 -FROM golang:1.18 +FROM golang:1.18-alpine as builder WORKDIR /app @@ -7,12 +7,17 @@ COPY . . RUN go mod download -RUN go build -o /server ./cmd/server/main.go +RUN CGO_ENABLED=0 go build -o /server ./cmd/server/main.go + +FROM alpine + +COPY --from=builder /server . +COPY --from=builder /app/tokens/ ./tokens EXPOSE 2022 EXPOSE 2023 -CMD [ "/server" ] +ENTRYPOINT [ "./server" ] diff --git a/internal/pkg/reactor/rlcoordinator.go b/internal/pkg/reactor/rlcoordinator.go index a39e6e4..a5ab7ad 100644 --- a/internal/pkg/reactor/rlcoordinator.go +++ b/internal/pkg/reactor/rlcoordinator.go @@ -97,7 +97,7 @@ func NewCoordinator(ip string,port int,ch chan error) *Coordinator { c.Ip = ip c.Port = port c.hw = &hw{} - c.HB = time.Duration(1 * time.Second) + c.HB = time.Duration(5 * time.Second) c.PingTimer = make(chan struct{}) // this is going to be scuffed url := fmt.Sprintf("http://%s:8086",ip)