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 FROM node:23.5.0-alpine
# Tambah dependency penting untuk build # Mengatur port
RUN apk add --no-cache libc6-compat
# Set port
ENV PORT 3000 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 WORKDIR /usr/src/app
# Copy package.json dan lockfile # Menyalin file penting terlebih dahulu untuk caching
COPY package*.json ./ COPY package.json ./
# Install dependencies # Menyalin direktori ckeditor5 jika diperlukan
RUN npm ci
# Copy vendor ckeditor kalau perlu
COPY vendor/ckeditor5 ./vendor/ckeditor5 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 . . COPY . .
# Build Next.js # Build aplikasi
RUN npm run build --debug RUN NODE_OPTIONS="--max-old-space-size=4096" pnpm next build
# Expose port # Expose port untuk server
EXPOSE 3000 EXPOSE 3000
# Start app # Perintah untuk menjalankan aplikasi
CMD ["npm", "run", "start"] CMD ["pnpm", "run", "start"]