add health check for sync docker

This commit is contained in:
xiaoyaofenfen 2022-06-16 13:47:01 +08:00
parent 3ef5e67d76
commit 1d8e16f5c9
2 changed files with 18 additions and 0 deletions

View File

@ -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

View File

@ -0,0 +1,13 @@
#!/bin/sh
# 检查aliyunpan进程是否存在
ps | awk '{print $4}' | grep aliyunpan
if [ $? == 0 ]
then
echo $?
exit 0
else
echo $?
exit 1
fi