This commit is contained in:
Anang Yusman 2025-12-30 19:56:50 +08:00
parent 1a9756db9b
commit c66427544f
1 changed files with 16 additions and 28 deletions

View File

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