Fix database path to avoid volume conflicts and update compose
This commit is contained in:
@@ -9,7 +9,7 @@ RUN npm install
|
||||
|
||||
# Build the application
|
||||
COPY . .
|
||||
ENV DATABASE_URL="file:./prisma/dev.db"
|
||||
ENV DATABASE_URL="file:/app/data/dev.db"
|
||||
RUN npx prisma generate
|
||||
RUN npm run build
|
||||
|
||||
@@ -19,7 +19,7 @@ WORKDIR /app
|
||||
|
||||
ENV NODE_ENV=production
|
||||
ENV PORT=3000
|
||||
ENV DATABASE_URL="file:./prisma/dev.db"
|
||||
ENV DATABASE_URL="file:/app/data/dev.db"
|
||||
|
||||
# Install production dependencies only
|
||||
COPY package*.json ./
|
||||
@@ -39,6 +39,7 @@ COPY --from=builder /app/node_modules/.prisma ./node_modules/.prisma
|
||||
COPY --from=builder /app/node_modules/@prisma ./node_modules/@prisma
|
||||
|
||||
# Script to run migrations and start the app
|
||||
RUN mkdir -p /app/data
|
||||
RUN printf "#!/bin/sh\nnpx prisma migrate deploy\nnpm start" > /app/start.sh
|
||||
RUN chmod +x /app/start.sh
|
||||
|
||||
|
||||
@@ -4,5 +4,5 @@ services:
|
||||
ports:
|
||||
- "3000:3000"
|
||||
volumes:
|
||||
- ./data:/app/prisma
|
||||
- ./data:/app/data
|
||||
restart: always
|
||||
|
||||
Reference in New Issue
Block a user