# Multi-stage build FROM node:20-alpine AS builder WORKDIR /app COPY package*.json ./ RUN npm ci COPY . . # Optional build args - will use defaults from config.ts if not provided # If ARG is not provided, ENV will be empty and config.ts will use defaults ARG VITE_DEFAULT_RELAYS ARG VITE_THREAD_TIMEOUT_DAYS ENV VITE_DEFAULT_RELAYS=${VITE_DEFAULT_RELAYS} ENV VITE_THREAD_TIMEOUT_DAYS=${VITE_THREAD_TIMEOUT_DAYS} RUN npm run build # Production stage - Node.js runtime FROM node:20-alpine WORKDIR /app # Copy package files and install production dependencies only COPY package*.json ./ RUN npm ci --only=production && npm cache clean --force # Copy built application from builder stage COPY --from=builder /app/build ./build # Copy public directory (for static assets like changelog.yaml, healthz.json) COPY --from=builder /app/public ./public # Copy entrypoint script COPY docker-entrypoint.sh /usr/local/bin/ RUN chmod +x /usr/local/bin/docker-entrypoint.sh ARG PORT=9876 ENV PORT=${PORT} ENV NODE_ENV=production ENV HOST=0.0.0.0 EXPOSE ${PORT} ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]