From 1004707d8f95a1bfc3835e5c057812cd03529118 Mon Sep 17 00:00:00 2001 From: Silvio Date: Sun, 31 May 2026 17:04:27 -0500 Subject: [PATCH] fix: archivos deploy --- Dockerfile | 13 ++++++++++--- deploy-auto.sh | 2 +- docker-compose.yml | 6 +++--- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3a0480c..1c5ff17 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,6 +18,14 @@ ENV NEXT_PUBLIC_SUPABASE_ANON_KEY=$NEXT_PUBLIC_SUPABASE_ANON_KEY RUN npm run build +# Next.js standalone creates a subdirectory named after the project folder. +# We flatten it to a known location so the runner doesn't depend on the name. +RUN echo "=== Standalone output structure ===" && \ + ls -la /app/.next/standalone/ && \ + mkdir -p /app/.next/standalone-export && \ + cp -r /app/.next/standalone/*/ /app/.next/standalone-export/ && \ + ls -la /app/.next/standalone-export/ + # ─── Stage 2: Production Runner ──────────────────────────────────────────── FROM node:20-alpine AS runner WORKDIR /app @@ -30,9 +38,8 @@ ENV HOSTNAME=0.0.0.0 RUN addgroup --system --gid 1001 nodejs RUN adduser --system --uid 1001 nextjs -# Next.js standalone output includes a subdir named after the project. -# Copy from standalone/cirux/ directly to /app -COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone/cirux/ ./ +# Copy flattened standalone output (server.js is now directly in /app) +COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone-export/ ./ # Copy static assets (images, fonts, etc.) COPY --from=builder --chown=nextjs:nodejs /app/public ./public diff --git a/deploy-auto.sh b/deploy-auto.sh index 42fbbc1..ee49643 100644 --- a/deploy-auto.sh +++ b/deploy-auto.sh @@ -40,7 +40,7 @@ sleep 10 RETRIES=5 while [ $RETRIES -gt 0 ]; do - if curl -sf http://localhost:3020/api/health > /dev/null 2>&1; then + if curl -sf http://localhost:3000/api/health > /dev/null 2>&1; then echo "$(date '+%Y-%m-%d %H:%M:%S') - Deploy successful ✅" >> "$LOG_FILE" exit 0 fi diff --git a/docker-compose.yml b/docker-compose.yml index 853441f..248edc9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,11 +13,11 @@ services: - .env environment: - NODE_ENV=production - expose: - - "3020" + ports: + - "127.0.0.1:3020:3020" healthcheck: test: ["CMD", "node", "-e", "require('http').get('http://localhost:3000/api/health', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"] interval: 30s timeout: 5s retries: 3 - start_period: 10s \ No newline at end of file + start_period: 10s