76 lines
No EOL
2.2 KiB
Docker
76 lines
No EOL
2.2 KiB
Docker
# Build stage
|
|
FROM node:20-alpine AS build
|
|
|
|
WORKDIR /app
|
|
|
|
# Build-time environment variables
|
|
# These should be passed from docker-compose using ${PROTOCOL}://${HOST}:${PORT}
|
|
# CRA bakes these into the static build at compile time
|
|
ARG REACT_APP_KEYCLOAK_URL
|
|
ARG REACT_APP_KEYCLOAK_REALM=didi-admins
|
|
ARG REACT_APP_KEYCLOAK_CLIENT_ID=admin-dashboard
|
|
ARG REACT_APP_API_BASE_URL
|
|
ARG REACT_APP_HOST
|
|
ARG REACT_APP_DIDIAI_GATEWAY_URL
|
|
ARG REACT_APP_KONG_GATEWAY_URL
|
|
ARG REACT_APP_KONG_ADMIN_URL
|
|
ARG REACT_APP_STAGING_MODE=false
|
|
ENV REACT_APP_STAGING_MODE=$REACT_APP_STAGING_MODE
|
|
|
|
# Service ports for dashboard UI
|
|
ARG REACT_APP_POSTGRES_PORT
|
|
ARG REACT_APP_PGADMIN_PORT
|
|
ARG REACT_APP_REDIS_PORT
|
|
ARG REACT_APP_COMMANDER_PORT
|
|
ARG REACT_APP_MINIO_CONSOLE_PORT
|
|
ARG REACT_APP_RABBITMQ_MGMT_PORT
|
|
ARG REACT_APP_ORCHESTRATOR_PORT
|
|
ARG REACT_APP_ANALYSIS_PORT
|
|
ARG REACT_APP_KONG_PROXY_PORT
|
|
ARG REACT_APP_KONG_ADMIN_PORT
|
|
ARG REACT_APP_KONG_MANAGER_PORT
|
|
ARG REACT_APP_KEYCLOAK_PORT
|
|
|
|
# DIDI Platform service ports
|
|
ARG REACT_APP_DIDI_PLATFORM_IP
|
|
ARG REACT_APP_DIDI_CATALOG_PORT
|
|
ARG REACT_APP_DIDI_LLM_PORT
|
|
ARG REACT_APP_DIDI_GPT_OSS_PORT
|
|
ARG REACT_APP_DIDI_QWEN_VL_PORT
|
|
ARG REACT_APP_DIDI_WHISPER_PORT
|
|
ARG REACT_APP_DIDI_BUSTERX_PORT
|
|
ARG REACT_APP_DIDI_VIDEO_PORT
|
|
ARG REACT_APP_DIDI_WEB_PORT
|
|
|
|
# Copy package files and lockfile for reproducible builds
|
|
COPY package.json package-lock.json ./
|
|
|
|
# Install dependencies - using npm install due to outdated lock file
|
|
RUN npm install --legacy-peer-deps
|
|
|
|
# Copy application code including .env
|
|
COPY . .
|
|
|
|
# Verify react-scripts is installed and build
|
|
RUN ls -la node_modules/.bin/ && \
|
|
node node_modules/react-scripts/scripts/build.js
|
|
|
|
# Production stage
|
|
FROM nginx:alpine
|
|
|
|
# Remove default nginx page, copy built assets
|
|
# Files go to both /admin/ (for direct access) and root (for Kong strip_path)
|
|
RUN rm -rf /usr/share/nginx/html/*
|
|
COPY --from=build /app/build /usr/share/nginx/html/admin
|
|
COPY --from=build /app/build /usr/share/nginx/html
|
|
|
|
# Copy nginx SSL configuration and certificates
|
|
COPY nginx-ssl.conf /etc/nginx/conf.d/default.conf
|
|
COPY ssl/server.crt /etc/nginx/ssl/server.crt
|
|
COPY ssl/server.key /etc/nginx/ssl/server.key
|
|
|
|
# Expose ports
|
|
EXPOSE 443 80
|
|
|
|
# Start nginx
|
|
CMD ["nginx", "-g", "daemon off;"] |