fix
This commit is contained in:
+3
-1
@@ -45,9 +45,11 @@ RUN addgroup --system --gid 1001 nodejs
|
|||||||
RUN adduser --system --uid 1001 nextjs
|
RUN adduser --system --uid 1001 nextjs
|
||||||
|
|
||||||
# Copy necessary files from builder
|
# Copy necessary files from builder
|
||||||
COPY --from=builder /app/public ./public
|
# Note: Copy public first, then standalone (which may have a minimal public/)
|
||||||
COPY --from=builder /app/.next/standalone ./
|
COPY --from=builder /app/.next/standalone ./
|
||||||
COPY --from=builder /app/.next/static ./.next/static
|
COPY --from=builder /app/.next/static ./.next/static
|
||||||
|
# Explicitly copy all public assets (standalone doesn't include everything)
|
||||||
|
COPY --from=builder /app/public ./public
|
||||||
|
|
||||||
# Copy scripts and node_modules needed for Wikipedia/opening setup
|
# Copy scripts and node_modules needed for Wikipedia/opening setup
|
||||||
COPY --from=builder /app/scripts ./scripts
|
COPY --from=builder /app/scripts ./scripts
|
||||||
|
|||||||
@@ -3,13 +3,28 @@ set -e
|
|||||||
|
|
||||||
echo "🔧 Chess Tutor Docker Entrypoint"
|
echo "🔧 Chess Tutor Docker Entrypoint"
|
||||||
|
|
||||||
# Create directories if they don't exist
|
# Create directories if they don't exist (with error handling)
|
||||||
mkdir -p public/openings
|
mkdir -p public/openings 2>/dev/null || echo "⚠️ Cannot create public/openings (may already exist)"
|
||||||
mkdir -p public/wikipedia
|
mkdir -p public/wikipedia 2>/dev/null || echo "⚠️ Cannot create public/wikipedia (volume mounted)"
|
||||||
|
mkdir -p fixtures/tactics 2>/dev/null || echo "⚠️ Cannot create fixtures/tactics (volume mounted)"
|
||||||
|
mkdir -p downloads 2>/dev/null || echo "⚠️ Cannot create downloads (volume mounted)"
|
||||||
|
|
||||||
|
# Check if opening database exists
|
||||||
|
if [ ! -f "public/openings/ecoA.json" ]; then
|
||||||
|
echo "⚠️ Warning: Opening database not found in public/openings/"
|
||||||
|
echo " Please ensure opening database files (ecoA-E.json, moveIndex.json) are in your build context"
|
||||||
|
echo " The application will continue but opening training may not work properly"
|
||||||
|
else
|
||||||
|
echo "✅ Opening database found"
|
||||||
|
fi
|
||||||
|
|
||||||
# Check if Wikipedia cache needs to be populated
|
# Check if Wikipedia cache needs to be populated
|
||||||
if [ ! -f "public/wikipedia/.initialized" ] || [ -z "$(ls -A public/wikipedia/*.json 2>/dev/null)" ]; then
|
# Count JSON files (excluding index.json and .gitkeep)
|
||||||
echo "📚 Fetching Wikipedia opening data..."
|
WIKI_COUNT=$(find public/wikipedia -name "*.json" -not -name "index.json" 2>/dev/null | wc -l | tr -d ' ')
|
||||||
|
|
||||||
|
if [ "$WIKI_COUNT" -lt 10 ]; then
|
||||||
|
echo "📚 Wikipedia cache empty or incomplete (found $WIKI_COUNT files)"
|
||||||
|
echo " Fetching Wikipedia opening data..."
|
||||||
npm run cache:wikipedia || echo "⚠️ Warning: Wikipedia fetch failed, continuing..."
|
npm run cache:wikipedia || echo "⚠️ Warning: Wikipedia fetch failed, continuing..."
|
||||||
|
|
||||||
echo "🔗 Updating Wikipedia slugs in opening database..."
|
echo "🔗 Updating Wikipedia slugs in opening database..."
|
||||||
@@ -18,18 +33,11 @@ if [ ! -f "public/wikipedia/.initialized" ] || [ -z "$(ls -A public/wikipedia/*.
|
|||||||
echo "📊 Rebuilding opening move index..."
|
echo "📊 Rebuilding opening move index..."
|
||||||
npm run build:opening-index || echo "⚠️ Warning: Move index rebuild failed, continuing..."
|
npm run build:opening-index || echo "⚠️ Warning: Move index rebuild failed, continuing..."
|
||||||
|
|
||||||
# Mark as initialized
|
# Mark as initialized (with error handling for permissions)
|
||||||
touch public/wikipedia/.initialized
|
touch public/wikipedia/.initialized 2>/dev/null || echo "⚠️ Cannot create marker file (permission issue, but cache is populated)"
|
||||||
echo "✅ Wikipedia data initialized"
|
echo "✅ Wikipedia data initialized"
|
||||||
else
|
else
|
||||||
echo "✅ Wikipedia cache already populated, skipping..."
|
echo "✅ Wikipedia cache already populated ($WIKI_COUNT files), skipping..."
|
||||||
fi
|
|
||||||
|
|
||||||
# Check if opening database exists
|
|
||||||
if [ ! -f "public/openings/ecoA.json" ]; then
|
|
||||||
echo "⚠️ Warning: Opening database not found in public/openings/"
|
|
||||||
echo " Please ensure opening database files (ecoA-E.json, moveIndex.json) are available"
|
|
||||||
echo " The application will continue but opening training may not work properly"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "🚀 Starting Chess Tutor application..."
|
echo "🚀 Starting Chess Tutor application..."
|
||||||
|
|||||||
Reference in New Issue
Block a user