Merge pull request #2 from ZimengXiong/fix-bind-mount-prisma

fix bind mount prisma, auto hydrate empty folder
This commit is contained in:
Zimeng Xiong
2025-11-22 20:25:44 -08:00
committed by GitHub
2 changed files with 8 additions and 1 deletions
+2 -1
View File
@@ -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
+6
View File
@@ -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