diff --git a/Dockerfile b/Dockerfile index cd2be40..26bd38e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,9 +6,13 @@ WORKDIR /app COPY package.json package-lock.json* ./ COPY ./prisma ./prisma +# Install all dependencies (including devDependencies) RUN npm install + +# Generate Prisma client RUN npx prisma generate +# Build the application COPY . . RUN npm run build @@ -19,13 +23,16 @@ WORKDIR /app ENV NODE_ENV production -# Install production dependencies INCLUDING prisma +# Copy package files COPY package.json package-lock.json* ./ -RUN npm install --production --ignore-scripts -# Copy needed Prisma files -COPY --from=builder /app/node_modules/.prisma /app/node_modules/.prisma -COPY --from=builder /app/node_modules/@prisma /app/node_modules/@prisma +# Copy node_modules from builder +COPY --from=builder /app/node_modules ./node_modules + +# Remove dev dependencies +RUN npm prune --production + +# Copy Prisma files COPY --from=builder /app/prisma ./prisma # Copy built application @@ -36,5 +43,5 @@ COPY --from=builder /app/next.config.js* ./ EXPOSE 3000 -# Run migrations first, then start app -CMD ["sh", "-c", "npx prisma migrate deploy && npm start"] \ No newline at end of file +# Run migrations and start +CMD ["sh", "-c", "npx prisma migrate deploy && npm start"]