30 lines
492 B
Text
30 lines
492 B
Text
|
|
# Build stage
|
||
|
|
FROM node:20-alpine AS builder
|
||
|
|
|
||
|
|
WORKDIR /app
|
||
|
|
|
||
|
|
# Copy package files
|
||
|
|
COPY package*.json ./
|
||
|
|
|
||
|
|
# Install dependencies
|
||
|
|
RUN npm ci --only=production
|
||
|
|
|
||
|
|
# Copy app files
|
||
|
|
COPY . .
|
||
|
|
|
||
|
|
# Build the app
|
||
|
|
RUN npm run build
|
||
|
|
|
||
|
|
# Production stage
|
||
|
|
FROM nginx:alpine
|
||
|
|
|
||
|
|
# Copy built app from builder stage
|
||
|
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
||
|
|
|
||
|
|
# Copy nginx config
|
||
|
|
COPY docker/nginx/frontend.conf /etc/nginx/conf.d/default.conf
|
||
|
|
|
||
|
|
# Expose port 80
|
||
|
|
EXPOSE 80
|
||
|
|
|
||
|
|
CMD ["nginx", "-g", "daemon off;"]
|