mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-05 12:00:59 +08:00
feat: 使用容器创建初始化所需的config.json和config.db
This commit is contained in:
@@ -1,4 +1,19 @@
|
|||||||
services:
|
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)
|
# Backend service (API and core logic)
|
||||||
nofx:
|
nofx:
|
||||||
build:
|
build:
|
||||||
@@ -18,6 +33,9 @@ services:
|
|||||||
- TZ=${NOFX_TIMEZONE:-Asia/Shanghai} # Set timezone
|
- TZ=${NOFX_TIMEZONE:-Asia/Shanghai} # Set timezone
|
||||||
networks:
|
networks:
|
||||||
- nofx-network
|
- nofx-network
|
||||||
|
depends_on:
|
||||||
|
config-init:
|
||||||
|
condition: service_completed_successfully
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "curl", "-f", "http://localhost:8080/api/health"]
|
test: ["CMD", "curl", "-f", "http://localhost:8080/api/health"]
|
||||||
interval: 30s
|
interval: 30s
|
||||||
@@ -47,4 +65,4 @@ services:
|
|||||||
|
|
||||||
networks:
|
networks:
|
||||||
nofx-network:
|
nofx-network:
|
||||||
driver: bridge
|
driver: bridge
|
||||||
|
|||||||
Reference in New Issue
Block a user