File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -22,12 +22,19 @@ RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} GOARM=${GOARM} make buil
22
22
# RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} GOARM=${GOARM} go build -ldflags="-w -s" -o /go/bin/teslaBleHttpProxy main.go
23
23
RUN mkdir -p /go/bin/key
24
24
25
- FROM scratch
25
+ # FROM scratch
26
+ FROM alpine:3.21
27
+
26
28
# Timezone data
27
29
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
28
30
ENV TZ=Europe/Berlin
29
31
# WORKDIR /app/
30
32
COPY --from=builder /go/bin/teslaBleHttpProxy /teslaBleHttpProxy
31
33
COPY --from=builder /go/bin/key /key
34
+ COPY healthcheck.sh /healthcheck.sh
35
+ RUN chmod +x /healthcheck.sh
32
36
EXPOSE 8080
37
+
38
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD /healthcheck.sh
39
+
33
40
ENTRYPOINT ["/teslaBleHttpProxy" ]
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ THRESHOLD_BYTES=100000000
4
+
5
+ MEMORY_USAGE_BYTES=$( cat /sys/fs/cgroup/memory.current)
6
+
7
+ if [ $MEMORY_USAGE_BYTES -gt $THRESHOLD_BYTES ]; then
8
+ echo " Memory usage ($MEMORY_USAGE_BYTES ) exceeds threshold ($THRESHOLD_BYTES )"
9
+ exit 1
10
+ else
11
+ echo " Memory usage OK: $MEMORY_USAGE_BYTES "
12
+ exit 0
13
+ fi
You can’t perform that action at this time.
0 commit comments