From 34f61aff509c4d1b16a9dc498e5de806bc4aeab9 Mon Sep 17 00:00:00 2001 From: darkedge <39146020@qq.com> Date: Mon, 3 Nov 2025 17:27:01 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BD=BF=E7=94=A8=E5=AE=B9=E5=99=A8?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E5=88=9D=E5=A7=8B=E5=8C=96=E6=89=80=E9=9C=80?= =?UTF-8?q?=E7=9A=84config.json=E5=92=8Cconfig.db?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-compose.yml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index e2f6c905..7c2b3207 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,19 @@ services: + # Init service: ensure config.db file exists before backend starts + config-init: + image: busybox:1.36 + command: + - sh + - -c + - > + touch /mnt/config.db && + if [ ! -f /mnt/config.json ] && [ -f /mnt/config.json.example ]; then + cp /mnt/config.json.example /mnt/config.json; + fi + volumes: + - ./:/mnt + restart: "no" + # Backend service (API and core logic) nofx: build: @@ -18,6 +33,9 @@ services: - TZ=${NOFX_TIMEZONE:-Asia/Shanghai} # Set timezone networks: - nofx-network + depends_on: + config-init: + condition: service_completed_successfully healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8080/api/health"] interval: 30s @@ -47,4 +65,4 @@ services: networks: nofx-network: - driver: bridge \ No newline at end of file + driver: bridge