31 lines
728 B
Docker
31 lines
728 B
Docker
FROM node:20-alpine as builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy root package files
|
|
COPY package*.json ./
|
|
COPY packages/frontend/package*.json ./packages/frontend/
|
|
|
|
# Install dependencies
|
|
RUN npm install
|
|
|
|
# Copy source code
|
|
COPY packages/frontend/ ./packages/frontend/
|
|
|
|
# Build the app
|
|
RUN cd packages/frontend && npm run build
|
|
|
|
# Production image
|
|
FROM nginx:alpine
|
|
|
|
# Copy nginx configuration
|
|
COPY packages/frontend/nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
# Copy built files from builder stage
|
|
COPY --from=builder /app/packages/frontend/dist /usr/share/nginx/html
|
|
|
|
# Add health check
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
|
CMD wget --quiet --tries=1 --spider http://localhost:80/ || exit 1
|
|
|
|
EXPOSE 80 |