Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

Optimize frontend Docker build and Vite config

Juan Denis93eccda09c89
diff --git a/frontend/.dockerignore b/frontend/.dockerignore
new file mode 100644
index 00000000..46d6497f
--- /dev/null
+++ b/frontend/.dockerignore
@@ -0,0 +1,10 @@
+node_modules
+dist
+.git
+.gitignore
+*.md
+.env*
+.vscode
+.idea
+.DS_Store
+Thumbs.db
diff --git a/frontend/Dockerfile b/frontend/Dockerfile
index 4884a47e..3db7b0e4 100644
--- a/frontend/Dockerfile
+++ b/frontend/Dockerfile
@@ -14,7 +14,7 @@ RUN npm ci
COPY . .
# Build the application
-RUN npm run build
+RUN NODE_OPTIONS="--max-old-space-size=4096" npm run build
# Stage 2: Production
FROM nginx:alpine
diff --git a/frontend/vite.config.js b/frontend/vite.config.js
index 848cb8fd..c483b80a 100644
--- a/frontend/vite.config.js
+++ b/frontend/vite.config.js
@@ -11,4 +11,17 @@ export default defineConfig({
interval: 1000,
},
},
+ build: {
+ rollupOptions: {
+ output: {
+ manualChunks: {
+ 'vendor-react': ['react', 'react-dom', 'react-router-dom'],
+ 'vendor-charts': ['recharts'],
+ 'vendor-flow': ['@xyflow/react'],
+ 'vendor-xterm': ['@xterm/xterm', '@xterm/addon-fit', '@xterm/addon-web-links'],
+ 'vendor-icons': ['lucide-react'],
+ },
+ },
+ },
+ },
})
diff --git a/install.sh b/install.sh
index ce21d02c..f44ccdc9 100644
--- a/install.sh
+++ b/install.sh
@@ -244,12 +244,12 @@ print_success "Nginx proxy configured"
# Clean up Docker networks to prevent issues
print_info "Cleaning up Docker..."
docker network prune -f 2>/dev/null || true
-docker system prune -f 2>/dev/null || true
+docker container prune -f 2>/dev/null || true
# Build and start frontend container
print_info "Building frontend container..."
cd "$INSTALL_DIR"
-docker compose build --no-cache
+docker compose build
print_info "Starting services..."