Merge branch 'main' of https://gitlab.com/hanifsalafi/mediahub_redesign into dev-sabda-v2
This commit is contained in:
commit
a69d3afa72
39
Dockerfile
39
Dockerfile
|
|
@ -1,34 +1,37 @@
|
|||
# Menggunakan image Node.js yang lebih ringan
|
||||
# Gunakan base image Node.js Alpine yang ringan
|
||||
FROM node:23.5.0-alpine
|
||||
|
||||
# Mengatur port
|
||||
ENV PORT 3000
|
||||
# Atur environment
|
||||
ENV PORT=3000
|
||||
ENV NODE_ENV=production
|
||||
ENV NODE_OPTIONS="--max-old-space-size=4096"
|
||||
|
||||
# Install pnpm secara global
|
||||
RUN npm install -g pnpm
|
||||
# Install dependencies global
|
||||
RUN npm install -g pnpm pm2
|
||||
|
||||
# Membuat direktori aplikasi dan mengatur sebagai working directory
|
||||
# Set working directory
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
# Salin file penting untuk caching dependencies
|
||||
COPY package.json pnpm-lock.yaml* ./
|
||||
|
||||
# Menyalin file penting terlebih dahulu untuk caching
|
||||
COPY package.json ./
|
||||
|
||||
# Menyalin direktori ckeditor5 jika diperlukan
|
||||
# Salin vendor jika diperlukan (ckeditor misalnya)
|
||||
COPY vendor/ckeditor5 ./vendor/ckeditor5
|
||||
|
||||
# Install dependencies
|
||||
RUN pnpm install
|
||||
# RUN pnpm install --frozen-lockfile
|
||||
RUN pnpm install --frozen-lockfile
|
||||
|
||||
# Menyalin source code aplikasi
|
||||
# Salin semua source code
|
||||
COPY . .
|
||||
|
||||
# Build aplikasi
|
||||
RUN NODE_OPTIONS="--max-old-space-size=4096" pnpm run build
|
||||
# Salin ecosystem config
|
||||
COPY ecosystem.config.js ./
|
||||
|
||||
# Expose port untuk server
|
||||
# Build Next.js
|
||||
RUN pnpm run build
|
||||
|
||||
# Expose port
|
||||
EXPOSE 3000
|
||||
|
||||
# Perintah untuk menjalankan aplikasi
|
||||
CMD ["pnpm", "run", "start"]
|
||||
# Jalankan Next.js dalam mode cluster
|
||||
CMD ["pm2-runtime", "start", "ecosystem.config.js"]
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
module.exports = {
|
||||
apps: [
|
||||
{
|
||||
name: "next-app",
|
||||
script: "node_modules/next/dist/bin/next",
|
||||
args: "start -p 3000",
|
||||
cwd: "/usr/src/app",
|
||||
instances: "max",
|
||||
exec_mode: "cluster",
|
||||
env: {
|
||||
NODE_ENV: "production"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue