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