fix: auto initialize database on Docker build
This commit is contained in:
@@ -38,6 +38,10 @@ RUN mkdir -p /app/data && chmod 777 /app/data
|
|||||||
# 复制 node_modules
|
# 复制 node_modules
|
||||||
COPY --from=builder /app/node_modules ./node_modules
|
COPY --from=builder /app/node_modules ./node_modules
|
||||||
|
|
||||||
|
# 设置数据库环境变量并初始化数据库
|
||||||
|
ENV DATABASE_URL="file:./data/student.db"
|
||||||
|
RUN npx prisma db push
|
||||||
|
|
||||||
# 复制 Prisma
|
# 复制 Prisma
|
||||||
COPY --from=builder /app/prisma ./prisma
|
COPY --from=builder /app/prisma ./prisma
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user