fixing dockerfile

This commit is contained in:
rheiga19 2025-03-27 09:35:13 +07:00
parent a62dcf8b34
commit bcef197e9a
1 changed files with 8 additions and 10 deletions

View File

@ -4,16 +4,14 @@ FROM node:18-alpine AS builder
# Set working directory
WORKDIR /app
# Copy package.json and package-lock.json
COPY package.json package-lock.json ./
# Install dependencies
# Copy package.json dan install dependencies
COPY package.json ./
RUN npm install
# Copy project files
# Copy seluruh project
COPY . .
# Build the project
# Build project
RUN npm run build
# Stage 2: Run
@ -22,13 +20,13 @@ FROM node:18-alpine
# Set working directory
WORKDIR /app
# Copy built files from builder
# Copy built files dari stage builder
COPY --from=builder /app ./
# Install only production dependencies
RUN npm ci --omit=dev
# Install hanya dependencies produksi
RUN npm install --omit=dev
# Expose the application port (sesuaikan dengan port yang digunakan di package.json)
# Expose port sesuai dengan package.json (sesuaikan jika berbeda)
EXPOSE 8000
# Jalankan aplikasi dengan npm run preview