mediahub-fe/Dockerfile

42 lines
901 B
Docker

<<<<<<< HEAD
# Menggunakan image Node.js yang lebih ringan
FROM node:22.6.0-alpine
=======
# Gunakan base image Node.js Alpine yang ringan
FROM node:23.5.0-alpine
>>>>>>> f7b1b79c08fb402d324a2534d64950ed5ee89eb2
# Atur environment
ENV PORT=3000
ENV NODE_ENV=production
ENV NODE_OPTIONS="--max-old-space-size=4096"
# Install dependencies global
RUN npm install -g pnpm pm2
# Set working directory
WORKDIR /usr/src/app
# Salin file penting untuk caching dependencies
COPY package.json pnpm-lock.yaml* ./
# Salin vendor jika diperlukan (ckeditor misalnya)
COPY vendor/ckeditor5 ./vendor/ckeditor5
# Install dependencies
RUN pnpm install --frozen-lockfile
# Salin semua source code
COPY . .
# Salin ecosystem config
COPY ecosystem.config.js ./
# Build Next.js
RUN pnpm run build
# Expose port
EXPOSE 3000
# Jalankan Next.js dalam mode cluster
CMD ["pm2-runtime", "start", "ecosystem.config.js"]