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
# Create app directory
RUN mkdir -p /usr/src/app
# Install pnpm secara global
RUN npm install -g pnpm
# Membuat direktori aplikasi dan mengatur sebagai working directory
WORKDIR /usr/src/app
# Installing dependencies
COPY package*.json /usr/src/app/
# Menyalin file penting terlebih dahulu untuk caching
COPY package.json ./
# RUN npm install --force
RUN npm install --legacy-peer-deps
RUN npm install
# Menyalin direktori ckeditor5 jika diperlukan
COPY vendor/ckeditor5 ./vendor/ckeditor5
# Copying source files
COPY . /usr/src/app
# Menyalin env
COPY .env .env
# Building app
RUN npm run build
# Install dependencies
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
# Running the app
CMD "npm" "run" "start"
# Perintah untuk menjalankan aplikasi
CMD ["pnpm", "run", "start"]