From f5c835b5d932a1129ad305d98814323680a499c1 Mon Sep 17 00:00:00 2001 From: headlessdev <132705454+crocofied@users.noreply.github.com> Date: Wed, 16 Apr 2025 14:55:09 +0200 Subject: [PATCH] Hotfix Docker file 'bcrypt' error --- Dockerfile | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) 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"]