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 # Set working directory
WORKDIR /app WORKDIR /app
# Copy package.json and package-lock.json # Copy package.json dan install dependencies
COPY package.json package-lock.json ./ COPY package.json ./
# Install dependencies
RUN npm install RUN npm install
# Copy project files # Copy seluruh project
COPY . . COPY . .
# Build the project # Build project
RUN npm run build RUN npm run build
# Stage 2: Run # Stage 2: Run
@ -22,13 +20,13 @@ FROM node:18-alpine
# Set working directory # Set working directory
WORKDIR /app WORKDIR /app
# Copy built files from builder # Copy built files dari stage builder
COPY --from=builder /app ./ COPY --from=builder /app ./
# Install only production dependencies # Install hanya dependencies produksi
RUN npm ci --omit=dev 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 EXPOSE 8000
# Jalankan aplikasi dengan npm run preview # Jalankan aplikasi dengan npm run preview