Skip to content

Commit 6a336d6

Browse files
committed
fix: docker healthcheck
1 parent 21ad802 commit 6a336d6

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,22 @@ RUN cargo build --release
2525
### run the IC WS Gateway (we don't need the rust toolchain to run the binary)
2626
FROM debian:bullseye-slim AS runtime
2727
WORKDIR /ic-ws-gateway
28+
# install some utils
29+
RUN apt update
30+
RUN apt install -y curl
2831
# copy the compiled binary
2932
COPY --from=builder /ic-ws-gateway/target/release/ic_websocket_gateway .
3033

3134
EXPOSE 8080
3235
EXPOSE 9000
3336

37+
HEALTHCHECK --timeout=30s --interval=30s --retries=5 \
38+
CMD curl -i -N \
39+
-H "Connection: Upgrade" \
40+
-H "Upgrade: websocket" \
41+
-H "Sec-WebSocket-Version: 13" \
42+
-H "Sec-WebSocket-Key: jWPXCaHslL1epUzz0k29Qw==" \
43+
-X GET --head http://127.0.0.1:8080 | grep -q "HTTP/1.1 101 Switching Protocols" && exit 0 || exit 1
44+
3445
# run the Gateway
3546
ENTRYPOINT ["/ic-ws-gateway/ic_websocket_gateway"]

0 commit comments

Comments
 (0)