feat: update frontend Dockerfile with multi-stage build
This commit is contained in:
+7
-17
@@ -1,23 +1,13 @@
|
|||||||
# Use Node.js 22 LTS as base image
|
# Build stage
|
||||||
FROM node:22-alpine
|
FROM node:22-alpine AS builder
|
||||||
|
|
||||||
# Set working directory
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy package files
|
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
|
|
||||||
# Install dependencies
|
|
||||||
RUN npm ci
|
RUN npm ci
|
||||||
|
|
||||||
# Copy source code
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Build the application
|
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
# Expose port 8080
|
# Production stage
|
||||||
EXPOSE 8080
|
FROM nginx:alpine
|
||||||
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||||
# Run the application
|
EXPOSE 80
|
||||||
CMD ["npm", "run", "preview"]
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
Reference in New Issue
Block a user