37 lines
940 B
Docker
37 lines
940 B
Docker
# Stage 1: Build stage
|
|
FROM node:20-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy dependency definitions
|
|
COPY PostFundManagement.ConsoleUI/package*.json ./
|
|
|
|
# Install dependencies
|
|
RUN npm ci || npm install
|
|
|
|
# Copy application source
|
|
COPY PostFundManagement.ConsoleUI/ .
|
|
|
|
# Build Vite application for production
|
|
RUN npm run build
|
|
|
|
# Stage 2: Production Nginx Server
|
|
FROM nginx:alpine
|
|
|
|
# Copy nginx configuration
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
# Copy compiled static assets from build stage
|
|
COPY --from=builder /app/PostFundManagement.ConsoleUI/dist /usr/share/nginx/html
|
|
|
|
# Copy entrypoint script for dynamic runtime environment variables
|
|
COPY docker-entrypoint.sh /app/PostFundManagement.ConsoleUI/docker-entrypoint.sh
|
|
RUN chmod +x /app/PostFundManagement.ConsoleUI/docker-entrypoint.sh
|
|
|
|
# Expose port 3000
|
|
EXPOSE 3000
|
|
|
|
# Set entrypoint and default command
|
|
ENTRYPOINT ["/docker-entrypoint.sh"]
|
|
CMD ["nginx", "-g", "daemon off;"]
|