25 lines
446 B
Docker
25 lines
446 B
Docker
# Stage 1: Build stage
|
|
FROM node:18-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
COPY package.json .
|
|
COPY package-lock.json* . 2>/dev/null || true
|
|
RUN npm ci
|
|
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
# Stage 2: Production stage with Nginx
|
|
FROM nginx:alpine
|
|
|
|
# Copy custom nginx configuration
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
# Copy built files from builder
|
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
|
|
|
EXPOSE 80
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|