File size: 1,311 Bytes
366fe97
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/bin/bash

# Fix Docker with simpler startup

templates=(
  "devforge"
  "mobilefirst"
  "saasify"
  "startupkit"
  "analyticsdash"
  "blog"
  "changelog"
  "ai-chat"
  "search"
  "ecommerce"
  "api-docs"
)

for template in "${templates[@]}"; do
  dir="templates-repos/$template"

  if [ -d "$dir" ]; then
    echo "📦 Fixing $template Docker..."
    cd "$dir"

    # Create simpler Dockerfile
    cat > Dockerfile << 'EOF'
FROM node:20-slim

WORKDIR /app

# Copy everything
COPY . .

# Install dependencies
RUN npm ci --legacy-peer-deps

# Build the app
RUN npm run build

# Expose port
EXPOSE 3000

# Start with npm start
CMD ["npm", "start"]
EOF

    # Ensure package.json has proper start script
    if ! grep -q '"start":' package.json; then
      # Update package.json to add start script
      sed -i '' 's/"scripts": {/"scripts": {\n    "start": "next start -H 0.0.0.0 -p 3000",/' package.json
    fi

    # Remove standalone config from next.config.js
    if [ -f next.config.js ]; then
      sed -i '' "/output: 'standalone'/d" next.config.js
    fi

    # Commit and push
    git add -A
    git commit -m "Simplify Docker startup" 2>/dev/null || true
    git push hf main --force

    cd ../..
    echo "  ✅ Fixed $template"
  fi
done

echo ""
echo "✅ All templates fixed with simple Docker!"