This commit is contained in:
Anang Yusman 2025-12-30 20:05:47 +08:00
parent c66427544f
commit 2afa91edd1
1 changed files with 26 additions and 14 deletions

View File

@ -1,24 +1,36 @@
FROM node:21-alpine # Menggunakan image Node.js yang lebih ringan
FROM node:23.5.0-alpine
# Mengatur port
ENV PORT 4000 ENV PORT 4000
# Create app directory # Install pnpm secara global
RUN mkdir -p /usr/src/app RUN npm install -g pnpm
# Membuat direktori aplikasi dan mengatur sebagai working directory
WORKDIR /usr/src/app WORKDIR /usr/src/app
# Installing dependencies # Menyalin file penting terlebih dahulu untuk caching
COPY package*.json /usr/src/app/ COPY package.json ./
# RUN npm install --force # Menyalin direktori ckeditor5 jika diperlukan
RUN npm install --legacy-peer-deps COPY vendor/ckeditor5 ./vendor/ckeditor5
RUN npm install
# Copying source files # Menyalin env
COPY . /usr/src/app COPY .env .env
# Building app # Install dependencies
RUN npm run build RUN pnpm install
# RUN pnpm install --frozen-lockfile
# Menyalin source code aplikasi
COPY . .
# Build aplikasi
RUN NODE_OPTIONS="--max-old-space-size=4096" pnpm next build
# Expose port untuk server
EXPOSE 4000 EXPOSE 4000
# Running the app # Perintah untuk menjalankan aplikasi
CMD "npm" "run" "start" CMD ["pnpm", "run", "start"]