Skip to content

Commit 878d537

Browse files
committed
better healthcheck
1 parent 22b31ca commit 878d537

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

Dockerfile

+8-4
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,16 @@ WORKDIR /repo.git
2424
RUN git init --bare && \
2525
chown git -R /repo.git
2626

27-
COPY main.sh /
28-
2927
EXPOSE 22
3028

29+
COPY main.sh /
3130
ENTRYPOINT ["/main.sh"]
3231

33-
HEALTHCHECK --interval=5m --timeout=5s \
34-
CMD sshpass -p secret ssh git@localhost | grep -q 'fatal: Interactive git shell is not enabled' || exit 1
32+
### Configure local key for healthcheck
33+
34+
WORKDIR /root/.ssh
35+
RUN echo 'localhost '$(cat /etc/ssh/ssh_host_rsa_key.pub) >> known_hosts
36+
37+
COPY check.sh /
38+
HEALTHCHECK --interval=10s --timeout=3s CMD /check.sh
3539

check.sh

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
script -q -c 'sshpass -p secret ssh -t git@localhost | grep "fatal: Interactive git shell is not enabled." || exit 1'
4+

0 commit comments

Comments
 (0)