Skip to content

Commit e03c2d3

Browse files
committed
docker添加可选的health check功能
1 parent ca4bd8c commit e03c2d3

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

Dockerfile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,20 @@ FROM ubuntu:latest
33

44
LABEL MAINTAINER https://github.com/Nriver/trilium-translation
55

6+
# 添加curl jq命令给health check使用
7+
# 合并RUN减少镜像层数
8+
# 减少镜像大小 purge清理包列表
9+
RUN sed -i s@/archive.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list \
10+
&& apt-get clean \
11+
&& apt-get update \
12+
&& apt-get install -y curl jq \
13+
&& apt-get purge -y --auto-remove \
14+
&& rm -rf /var/lib/apt/lists/*
15+
616
ADD trilium-linux-x64-server /app/
717
WORKDIR /app
818

919
EXPOSE 8080
1020

11-
CMD ["./trilium.sh"]
21+
CMD ["./trilium.sh"]
22+

docker-compose.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,9 @@ services:
1111
environment:
1212
# 环境变量表示容器内笔记数据的存储路径
1313
- TRILIUM_DATA_DIR=/root/trilium-data
14+
# 可选功能: 健康检查。需要启用的话,把下面的注释去掉
15+
#healthcheck:
16+
# test: ["CMD-SHELL", "curl --fail http://localhost:8080/api/health-check | jq -e '.status == "ok"' || exit 1"]
17+
# interval: 30s
18+
# timeout: 10s
19+
# retries: 3

0 commit comments

Comments
 (0)