fix: use absolute path for DATABASE_URL in Docker
This commit is contained in:
@@ -39,7 +39,7 @@ RUN mkdir -p /app/data && chmod 777 /app/data
|
|||||||
COPY --from=builder /app/node_modules ./node_modules
|
COPY --from=builder /app/node_modules ./node_modules
|
||||||
|
|
||||||
# 设置数据库环境变量并初始化数据库
|
# 设置数据库环境变量并初始化数据库
|
||||||
ENV DATABASE_URL="file:./data/student.db"
|
ENV DATABASE_URL="file:/app/data/student.db"
|
||||||
RUN npx prisma db push
|
RUN npx prisma db push
|
||||||
|
|
||||||
# 复制 Prisma
|
# 复制 Prisma
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ services:
|
|||||||
# 持久化数据库文件
|
# 持久化数据库文件
|
||||||
- student-data:/app/data
|
- student-data:/app/data
|
||||||
environment:
|
environment:
|
||||||
- DATABASE_URL=file:./data/student.db
|
- DATABASE_URL=file:/app/data/student.db
|
||||||
- NODE_ENV=production
|
- NODE_ENV=production
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
healthcheck:
|
healthcheck:
|
||||||
|
|||||||
Reference in New Issue
Block a user