Skip to content

Commit 40cbd0f

Browse files
author
Issif
committedApr 15, 2020
fix panic when websocket fails multiple times + add Dockerfile
·
0.2.60.1.1
1 parent 73ad921 commit 40cbd0f

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed
 

‎Dockerfile‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Build image (Golang)
2+
FROM golang:alpine AS build-stage
3+
ENV GO111MODULE on
4+
ENV CGO_ENABLED 0
5+
6+
RUN apk add --no-cache gcc git make
7+
8+
WORKDIR /src
9+
ADD . .
10+
11+
RUN go mod download
12+
RUN go build -ldflags="-s -w" -o cercat
13+
14+
# Final Docker image
15+
FROM alpine AS final-stage
16+
LABEL MAINTAINER "Thomas Labarussias <issif+github@gadz.org>"
17+
18+
RUN apk add --no-cache ca-certificates
19+
20+
# Create user falcosidekick
21+
RUN addgroup -S cercat && adduser -u 1234 -S cercat -G cercat
22+
USER 1234
23+
24+
WORKDIR ${HOME}/
25+
COPY --from=build-stage /src/cercat .
26+
27+
EXPOSE 2801
28+
29+
ENTRYPOINT ["./cercat"]

‎main.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func main() {
6868
_, msg, err := ws.ReadMessage()
6969
if err != nil {
7070
log.Println("[ERROR] : Error reading message")
71-
continue
71+
break
7272
}
7373
msgChan <- msg
7474
}

0 commit comments

Comments
 (0)
Please sign in to comment.