update dockerfile
This commit is contained in:
parent
1ed85825f2
commit
a62dcf8b34
|
|
@ -1,10 +1,11 @@
|
|||
# Stage 1: Build
|
||||
FROM node:18-alpine AS builder
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package.json and package-lock.json
|
||||
COPY package.json ./
|
||||
COPY package.json package-lock.json ./
|
||||
|
||||
# Install dependencies
|
||||
RUN npm install
|
||||
|
|
@ -13,9 +14,9 @@ RUN npm install
|
|||
COPY . .
|
||||
|
||||
# Build the project
|
||||
RUN npm run start
|
||||
RUN npm run build
|
||||
|
||||
# Final stage
|
||||
# Stage 2: Run
|
||||
FROM node:18-alpine
|
||||
|
||||
# Set working directory
|
||||
|
|
@ -24,6 +25,9 @@ WORKDIR /app
|
|||
# Copy built files from builder
|
||||
COPY --from=builder /app ./
|
||||
|
||||
# Install only production dependencies
|
||||
RUN npm ci --omit=dev
|
||||
|
||||
# Expose the application port (sesuaikan dengan port yang digunakan di package.json)
|
||||
EXPOSE 8000
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue