fix bind mount prisma, auto hydrate empty folder
This commit is contained in:
+2
-1
@@ -36,8 +36,9 @@ COPY package*.json ./
|
|||||||
# Install production dependencies only
|
# Install production dependencies only
|
||||||
RUN npm ci --only=production
|
RUN npm ci --only=production
|
||||||
|
|
||||||
# Copy prisma schema and migrations
|
# Copy prisma schema and migrations for runtime and hydration template
|
||||||
COPY prisma ./prisma/
|
COPY prisma ./prisma/
|
||||||
|
COPY prisma ./prisma_template/
|
||||||
|
|
||||||
# Copy built application from builder
|
# Copy built application from builder
|
||||||
COPY --from=builder /app/dist ./dist
|
COPY --from=builder /app/dist ./dist
|
||||||
|
|||||||
@@ -1,6 +1,12 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
# Auto-hydrate prisma directory when bind-mounted volume is empty
|
||||||
|
if [ ! -f "/app/prisma/schema.prisma" ]; then
|
||||||
|
echo "Mount is empty. Hydrating /app/prisma from /app/prisma_template..."
|
||||||
|
cp -R /app/prisma_template/. /app/prisma/
|
||||||
|
fi
|
||||||
|
|
||||||
# Run migrations
|
# Run migrations
|
||||||
npx prisma migrate deploy
|
npx prisma migrate deploy
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user