33 lines
589 B
Docker
33 lines
589 B
Docker
# Build stage
|
|
FROM node:22-alpine AS builder # ⬅⬅ changed from 18 to 22
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy package files
|
|
COPY package*.json ./
|
|
|
|
# Install dependencies
|
|
RUN npm ci --prefer-offline --no-audit
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Build the application
|
|
RUN npm run build
|
|
|
|
# Production stage
|
|
FROM node:22-alpine # ⬅⬅ also here
|
|
|
|
WORKDIR /app
|
|
|
|
# Install a simple HTTP server to serve the built app
|
|
RUN npm install -g serve
|
|
|
|
# Copy built app from builder stage
|
|
COPY --from=builder /app/dist ./dist
|
|
|
|
EXPOSE 3000
|
|
|
|
# Serve the built app
|
|
CMD ["serve", "-s", "dist", "-l", "3000"]
|