Skip to content

Commit 888834c

Browse files
authored
Merge pull request #2 from ZimengXiong/fix-bind-mount-prisma
fix bind mount prisma, auto hydrate empty folder
2 parents 77c1824 + ae8f6d6 commit 888834c

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

backend/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ COPY package*.json ./
3636
# Install production dependencies only
3737
RUN npm ci --only=production
3838

39-
# Copy prisma schema and migrations
39+
# Copy prisma schema and migrations for runtime and hydration template
4040
COPY prisma ./prisma/
41+
COPY prisma ./prisma_template/
4142

4243
# Copy built application from builder
4344
COPY --from=builder /app/dist ./dist

backend/docker-entrypoint.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
#!/bin/sh
22
set -e
33

4+
# Auto-hydrate prisma directory when bind-mounted volume is empty
5+
if [ ! -f "/app/prisma/schema.prisma" ]; then
6+
echo "Mount is empty. Hydrating /app/prisma from /app/prisma_template..."
7+
cp -R /app/prisma_template/. /app/prisma/
8+
fi
9+
410
# Run migrations
511
npx prisma migrate deploy
612

0 commit comments

Comments
 (0)