feat: add a healthcheck script that works with a dynamic port (#2510)

This commit is contained in:
Andrew Kennedy 2023-07-22 14:07:15 -07:00 committed by GitHub
parent a664ba1f9d
commit ff4375cf6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -1,10 +1,14 @@
FROM alpine:latest FROM alpine:latest
RUN apk --update add ca-certificates \ RUN apk --update add ca-certificates \
mailcap \ mailcap \
curl curl \
jq
COPY healthcheck.sh /healthcheck.sh
RUN chmod +x /healthcheck.sh # Make the script executable
HEALTHCHECK --start-period=2s --interval=5s --timeout=3s \ HEALTHCHECK --start-period=2s --interval=5s --timeout=3s \
CMD curl -f http://localhost/health || exit 1 CMD /healthcheck.sh || exit 1
VOLUME /srv VOLUME /srv
EXPOSE 80 EXPOSE 80

3
healthcheck.sh Normal file
View File

@ -0,0 +1,3 @@
#!/bin/sh
PORT=$(jq .port /.filebrowser.json)
curl -f http://localhost:$PORT/health || exit 1