-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
113 lines (93 loc) · 3.73 KB
/
Dockerfile
File metadata and controls
113 lines (93 loc) · 3.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# ================================================
# Dockerfile for Unified Arda Platform
# Single React application serving all functionality
# ================================================
#
# DEVELOPMENT MODE (Current):
# ---------------------------
# Running Vite dev server for demos/testing
# Better support for large file uploads through proxy
#
# TODO FOR PRODUCTION:
# -------------------
# 1. Switch back to production build (Stage 2 with vite preview)
# 2. Add Nginx reverse proxy to handle large uploads
# 3. Or use a proper API gateway that doesn't have body size limits
# 4. Consider enabling HMR/hot reload features only in actual dev
#
# ================================================
# Stage 1: Install dependencies and prepare source
FROM node:18-alpine AS base
# Set working directory
WORKDIR /app
# Copy package files
COPY package.json pnpm-lock.yaml ./
# Install pnpm and dependencies
RUN npm install -g pnpm@9.9.0 && \
pnpm install --frozen-lockfile
# Stage 2: Development server using Vite dev mode
FROM node:18-alpine
# Set working directory
WORKDIR /app
# Install pnpm globally
RUN npm install -g pnpm@9.9.0
# Copy all source files and dependencies
COPY --from=base /app/node_modules ./node_modules
COPY --from=base /app/package.json ./package.json
COPY --from=base /app/pnpm-lock.yaml ./pnpm-lock.yaml
# Copy entire source tree (needed for dev server)
COPY . .
# Note: We're not building here since we'll run in dev mode
# Copy docker entrypoint script
COPY <<EOF /docker-entrypoint.sh
#!/bin/sh
# Simple startup logging
echo "🚀 Starting Unified Arda Platform with Vite Dev Server"
echo "📋 Configuration:"
echo " - Environment: \${VITE_SERVER_ENVIRONMENT:-development}"
echo " - RPC URL: \${VITE_ETHEREUM_RPC_URL:-(using /rpc proxy)}"
echo ""
echo "📡 Proxy Configuration (vite.config.ts):"
echo " - /server/* -> Backend service"
echo " - /chat/* -> Chat agent service"
echo " - /ingestion/* -> Ingestion service (supports large file uploads)"
echo " - /rpc/* -> Ethereum RPC"
echo ""
echo "⚠️ DEVELOPMENT MODE"
echo " Running Vite dev server for demos/testing"
echo " TODO: Switch to production build (vite preview) before production deployment"
echo " Reason: Dev server handles large file uploads better than preview mode"
# Inject environment variables into env-config.js
#
# NOTE: In dev mode, this file won't be used since we're not serving the built dist/
# but we'll create it anyway for consistency
mkdir -p /app/dist
cat > /app/dist/env-config.js << EOL
window.__ENV__ = {
VITE_SERVER_ENVIRONMENT: "\${VITE_SERVER_ENVIRONMENT:-development}",
VITE_ETHEREUM_RPC_URL: "\${VITE_ETHEREUM_RPC_URL:-}"
};
EOL
echo "✅ Environment configured, starting Vite dev server..."
echo "Server will be available on http://0.0.0.0:3000"
echo "Dev server supports large file uploads (up to 1GB)"
# Run Vite dev server in foreground
# NOTE: Dev server is better for demos but NOT suitable for production
# See: https://vitejs.dev/guide/cli.html#vite-preview
exec pnpm run dev --host 0.0.0.0 --port 3000
EOF
# Make entrypoint executable
RUN chmod +x /docker-entrypoint.sh
# Expose port 3000 (Vite dev server)
EXPOSE 3000
# Health check for container monitoring
# Note: Dev server might take longer to start than preview mode
HEALTHCHECK --interval=30s --timeout=10s --retries=3 --start-period=60s \
CMD wget --quiet --tries=1 --spider http://127.0.0.1:3000/ || exit 1
# Set entrypoint
ENTRYPOINT ["/docker-entrypoint.sh"]
# Labels for metadata
LABEL org.opencontainers.image.title="Arda Platform (Development Mode)"
LABEL org.opencontainers.image.description="Unified investment and document management platform - Development Build"
LABEL org.opencontainers.image.version="2.0.0-dev"
LABEL org.opencontainers.image.vendor="Arda Global"