fix: update dockerfile

This commit is contained in:
hanif salafi 2025-10-23 21:38:54 +07:00
parent abb5e0370f
commit 6b72b3e606
2 changed files with 10 additions and 7 deletions

View File

@ -14,10 +14,6 @@ WORKDIR /usr/src/app
# Salin file penting untuk caching dependencies
COPY package.json pnpm-lock.yaml* ./
COPY ecosystem.config.js ./
# Salin vendor jika diperlukan (ckeditor misalnya)
COPY vendor/ckeditor5 ./vendor/ckeditor5
# Install dependencies
RUN pnpm install --frozen-lockfile
@ -25,11 +21,17 @@ RUN pnpm install --frozen-lockfile
# Salin semua source code
COPY . .
# Salin ecosystem config
COPY ecosystem.config.js ./
# Salin vendor jika diperlukan (ckeditor misalnya)
COPY vendor/ckeditor5 ./vendor/ckeditor5
# Build Next.js
RUN pnpm run build
# Expose port
EXPOSE 3000
# Jalankan Next.js dalam mode cluster (gunakan semua core)
CMD ["pm2-runtime", "ecosystem.config.js"]
# Jalankan Next.js dalam mode cluster
CMD ["pm2-runtime", "start", "ecosystem.config.js"]

View File

@ -4,6 +4,7 @@ module.exports = {
name: "next-app",
script: "node_modules/next/dist/bin/next",
args: "start -p 3000",
cwd: "/usr/src/app",
instances: "max",
exec_mode: "cluster",
env: {
@ -11,4 +12,4 @@ module.exports = {
}
}
]
}
}