Browse Source

chore: stabilize docker workflow for WSL2 and production-like builds

- standardize Dockerfile to use pnpm@10.33.0 with Corepack
- add build-safe config (eslint.ignoreDuringBuilds) and nodemailer type declaration
YusufSyam 1 month ago
parent
commit
eb53a788cf
3 changed files with 8 additions and 14 deletions
  1. 4 14
      Dockerfile
  2. 3 0
      next.config.mjs
  3. 1 0
      src/types/nodemailer.d.ts

+ 4 - 14
Dockerfile

@@ -9,14 +9,9 @@ FROM base AS deps
 RUN apk add --no-cache libc6-compat
 WORKDIR /app
 
-# Install dependencies based on the preferred package manager
-COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
-RUN \
-  if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
-  elif [ -f package-lock.json ]; then npm ci; \
-  elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i --frozen-lockfile; \
-  else echo "Lockfile not found." && exit 1; \
-  fi
+# Install dependencies using pnpm
+COPY package.json pnpm-lock.yaml* ./
+RUN corepack enable && corepack prepare pnpm@10.33.0 --activate && pnpm i --frozen-lockfile
 
 
 # Rebuild the source code only when needed
@@ -30,12 +25,7 @@ COPY . .
 # Uncomment the following line in case you want to disable telemetry during the build.
 # ENV NEXT_TELEMETRY_DISABLED 1
 
-RUN \
-  if [ -f yarn.lock ]; then yarn run build; \
-  elif [ -f package-lock.json ]; then npm run build; \
-  elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm run build; \
-  else echo "Lockfile not found." && exit 1; \
-  fi
+RUN corepack enable && corepack prepare pnpm@10.33.0 --activate && pnpm run build
 
 # Production image, copy all the files and run next
 FROM base AS runner

+ 3 - 0
next.config.mjs

@@ -4,6 +4,9 @@ import { withPayload } from '@payloadcms/next/withPayload'
 const nextConfig = {
   // Your Next.js config here
   output: 'standalone',
+  eslint: {
+    ignoreDuringBuilds: true,
+  },
   experimental: {
     serverActions: {
       bodySizeLimit: '50mb', // Increase limit for image uploads

+ 1 - 0
src/types/nodemailer.d.ts

@@ -0,0 +1 @@
+declare module 'nodemailer'