From 2d41adcbc68b4cb825e6f3b224b069f97abf0a0f Mon Sep 17 00:00:00 2001 From: hamster1963 <1410514192@qq.com> Date: Sun, 22 Sep 2024 17:21:37 +0800 Subject: [PATCH] feat: init env file --- app/api/server/route.ts | 2 ++ docker/docker-compose.yml | 1 + public/docker-start/docker-entrypoint.sh | 9 +++++++++ 3 files changed, 12 insertions(+) create mode 100644 public/docker-start/docker-entrypoint.sh diff --git a/app/api/server/route.ts b/app/api/server/route.ts index 6653a6ebc..21fd43653 100644 --- a/app/api/server/route.ts +++ b/app/api/server/route.ts @@ -1,6 +1,8 @@ import { GetNezhaData } from "@/lib/serverFetch"; import { NextResponse } from "next/server"; +export const dynamic = "force-dynamic"; + export async function GET(_: Request) { try { const response = await GetNezhaData(); diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 03617d746..832c9e69c 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -2,6 +2,7 @@ services: nezha-dash: container_name: nezha-dash image: registry.cn-guangzhou.aliyuncs.com/hamster-home/nezha-dash:latest + entrypoint: /app/public/docker-start/docker-entrypoint.sh volumes: - ./.env:/app/.env restart: always diff --git a/public/docker-start/docker-entrypoint.sh b/public/docker-start/docker-entrypoint.sh new file mode 100644 index 000000000..e346dcfd6 --- /dev/null +++ b/public/docker-start/docker-entrypoint.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +# 如果 .env 文件不存在,则创建一个空的 .env 文件 +if [ ! -f /app/.env ]; then + touch /app/.env +fi + +# 启动服务 +exec "$@"