diff --git a/Dockerfile b/Dockerfile index 71b3c8c8..4b2d192f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"] \ No newline at end of file +# Jalankan Next.js dalam mode cluster +CMD ["pm2-runtime", "start", "ecosystem.config.js"] \ No newline at end of file diff --git a/ecosystem.config.js b/ecosystem.config.js index 30c15de8..c02a9706 100644 --- a/ecosystem.config.js +++ b/ecosystem.config.js @@ -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 = { } } ] -} +} \ No newline at end of file