platform-codebase/features/conversation-assistant/frontend-dev/Dockerfile

46 lines
1.2 KiB
Docker
Executable file

# =============================================================================
# CONVERSATION ASSISTANT FRONTEND: Production Dockerfile
# =============================================================================
# Multi-stage build for Vite React app
# =============================================================================
FROM node:22-alpine AS builder
WORKDIR /app
# Build arguments
ARG VITE_API_URL=https://conversations.nasty.sh/api
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm ci
# Copy source
COPY . .
# Set environment for build
ENV VITE_API_URL=$VITE_API_URL
# Build
RUN npm run build
# =============================================================================
# Production: Nginx to serve static files
# =============================================================================
FROM nginx:alpine AS runner
# Copy built files
COPY --from=builder /app/dist /usr/share/nginx/html
# Copy nginx config
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Expose port
EXPOSE 80
# Health check
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost/health || exit 1
CMD ["nginx", "-g", "daemon off;"]