This commit is contained in:
Anang Yusman 2025-09-23 00:18:18 +08:00
parent c382724044
commit 6eae36011d
1 changed files with 22 additions and 17 deletions

View File

@ -1,31 +1,36 @@
# Menggunakan image Node.js yang lebih ringan
FROM node:23.5.0-alpine
# Tambah dependency penting untuk build
RUN apk add --no-cache libc6-compat
# Set port
# Mengatur port
ENV PORT 3000
# Set working directory
# Install pnpm secara global
RUN npm install -g pnpm
# Membuat direktori aplikasi dan mengatur sebagai working directory
WORKDIR /usr/src/app
# Copy package.json dan lockfile
COPY package*.json ./
# Menyalin file penting terlebih dahulu untuk caching
COPY package.json ./
# Install dependencies
RUN npm ci
# Copy vendor ckeditor kalau perlu
# Menyalin direktori ckeditor5 jika diperlukan
COPY vendor/ckeditor5 ./vendor/ckeditor5
# Copy semua source code
# Menyalin env
COPY .env .env
# Install dependencies
RUN pnpm install
# RUN pnpm install --frozen-lockfile
# Menyalin source code aplikasi
COPY . .
# Build Next.js
RUN npm run build --debug
# Build aplikasi
RUN NODE_OPTIONS="--max-old-space-size=4096" pnpm next build
# Expose port
# Expose port untuk server
EXPOSE 3000
# Start app
CMD ["npm", "run", "start"]
# Perintah untuk menjalankan aplikasi
CMD ["pnpm", "run", "start"]