diff --git a/docker/sync/Dockerfile b/docker/sync/Dockerfile index be07ceb..2bcfaa4 100644 --- a/docker/sync/Dockerfile +++ b/docker/sync/Dockerfile @@ -31,6 +31,8 @@ RUN chmod 777 /home/app/data # 复制文件 COPY ./docker/sync/app.sh /home/app/app.sh RUN chmod +x /home/app/app.sh +COPY ./docker/sync/health_check.sh /home/app/health_check.sh +RUN chmod +x /home/app/health_check.sh COPY ./out/binary_files/aliyunpan /home/app RUN mkdir -p /home/app/config/plugin @@ -39,6 +41,9 @@ RUN mkdir -p /home/app/config/sync_drive COPY ./out/binary_files/sync_drive /home/app/config/sync_drive #RUN chmod +x /home/app/aliyunpan +# 健康检查 +HEALTHCHECK --start-period=5s --interval=10s --timeout=5s --retries=3 CMD /bin/sh /home/app/health_check.sh + # 环境变量 ENV ALIYUNPAN_CONFIG_DIR=/home/app/config diff --git a/docker/sync/health_check.sh b/docker/sync/health_check.sh new file mode 100644 index 0000000..57a197a --- /dev/null +++ b/docker/sync/health_check.sh @@ -0,0 +1,13 @@ +#!/bin/sh +# 检查aliyunpan进程是否存在 +ps | awk '{print $4}' | grep aliyunpan +if [ $? == 0 ] +then + echo $? + exit 0 +else + echo $? + exit 1 +fi + +