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

View File

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